+*.q[ch] linguist-language=C
+*.inc linguist-language=C
+
* -crlf
*.0 -diff -crlf
*.1 crlf=input
before_script:
- - git clone --depth=1 --branch=master https://gitlab.com/xonotic/darkplaces.git darkplaces
- - cd darkplaces && make sv-debug -j $(nproc)
- - cd ..
- - export ENGINE="$PWD/darkplaces/darkplaces-dedicated -xonotic"
+ - ln -s $PWD data/xonotic-data.pk3dir
- git clone --depth=1 --branch=master https://gitlab.com/xonotic/gmqcc.git gmqcc
- - cd gmqcc && make -j $(nproc)
+ - cd gmqcc && make -j $(nproc) && export QCC="$PWD/gmqcc"
- cd ..
- - export QCC="$PWD/gmqcc/gmqcc"
-
- - ln -s $PWD data/xonotic-data.pk3dir
-test_sv_unit:
+test_compilation_units:
stage: test
script:
- - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
- - make
- - while read line; do
- echo $line;
- if [[ $line == "All tests OK" ]]; then exit 0; fi;
- done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
- - exit 1
+ - ./qcsrc/tools/compilationunits.sh
test_sv_game:
stage: test
script:
+ - git clone --depth=1 --branch=master https://gitlab.com/xonotic/darkplaces.git darkplaces
+ - cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
+ - cd ..
+
- wget -O data/g-23.pk3 http://beta.xonotic.org/autobuild-bsp/latest/g-23.pk3
- make
- - EXPECT=44a15d27dcfb0bccddc73284e6d968e7
+ - EXPECT=07fdfd9a19025920a599995730eb2a78
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
- test "$HASH" == "$EXPECT"
- exit $?
+test_sv_unit:
+ stage: test
+ script:
+ - git clone --depth=1 --branch=master https://gitlab.com/xonotic/darkplaces.git darkplaces
+ - cd darkplaces && make sv-debug -j $(nproc) && export ENGINE="$PWD/darkplaces-dedicated -xonotic"
+ - cd ..
+
+ - mkdir maps && wget -O maps/gitlab-ci.bsp https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/_init/_init.bsp
+ - make
+ - while read line; do
+ echo $line;
+ if [[ $line == "All tests OK" ]]; then exit 0; fi;
+ done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
+ - exit 1
+
doxygen: # rename to 'pages' when gitlab.com allows pages to exceed 100MiB
stage: deploy
script:
- git clone --single-branch --depth 1 ${DEPLOY_HOST}:${DEPLOY_REPO} ~/deploy_
- mkdir ~/deploy && mv ~/deploy_/.git ~/deploy && rm -r ~/deploy_
- cp -r ../public/* ~/deploy
- - cd ~/deploy && git add -A . && git commit -m "Update" && git push origin gh-pages
+ - cd ~/deploy && git add -A . && git commit -m "Deploy ${CI_BUILD_REF}" && git push origin gh-pages
artifacts:
paths:
- public
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 2
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 80
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_alt_animtime 0.2
set g_balance_shotgun_secondary_alt_refire 1.2
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 70
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 80
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 80
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 70
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 70
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_frozen_force 0.6 "How much to multiply the force on a frozen player with"
// player statistics server URI
-set g_playerstats_uri "" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
+set g_playerstats_gamereport_uri "http://stats.xonotic.org/stats/submit" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
// autoscreenshots
set g_max_info_autoscreenshot 3 "how many info_autoscreenshot entities are allowed"
exec effects-normal.cfg
exec physicsX.cfg
exec turrets.cfg
-exec vehicles.cfg
exec crosshairs.cfg
exec gamemodes.cfg
exec mutators.cfg
/html/
-/qccversion*
/*.pk3
# this will also influence the order of the classes in the class list.
# The default value is: NO.
-SORT_BRIEF_DOCS = NO
+SORT_BRIEF_DOCS = YES
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
# (brief and detailed) documentation of class members so that constructors and
# detailed member documentation.
# The default value is: NO.
-SORT_MEMBERS_CTORS_1ST = NO
+SORT_MEMBERS_CTORS_1ST = YES
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-MACRO_EXPANSION = NO
+MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_ONLY_PREDEF = NO
+EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH = .
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED = \
+ "USING(name, T)=using name = T" \
+ "CLASS(name, base)=class name : public base { public:" \
+ "INIT(class)=class::class()" \
+ "CONSTRUCTOR(class)=class::class(" \
+ "DESTRUCTOR(class)=class::~class()" \
+ "ATTRIB(class, name, T, val)=T name = val;" \
+ "ATTRIB_STRZONE(class, name, T, val)=T name = val;" \
+ "STATIC_ATTRIB(class, name, T, val)=static T name = val;" \
+ "STATIC_ATTRIB_STRZONE(class, name, T, val)=static T name = val;" \
+ "METHOD(class, name, prototype)=virtual void class::name()" \
+ "ENDCLASS(class)=};" \
+ __STDC__
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED = \
+ USING \
+ CLASS \
+ INIT CONSTRUCTOR DESTRUCTOR \
+ ATTRIB ATTRIB_STRZONE \
+ STATIC_ATTRIB STATIC_ATTRIB_STRZONE \
+ METHOD \
+ ENDCLASS \
+ LABEL \
+ __STDC__
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
PROGS_OUT ?= $(CURDIR)/..
WORKDIR ?= ../.tmp
-QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='*')
-VER = $(QCCFLAGS_WATERMARK)
+QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
+VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
NDEBUG ?= 1
BUILD_MOD ?= 0
@ $(RM) $(WORKDIR)/qccversion.*
@ echo $(QCCVERSION) > $@
+export WORKDIR
export CPP
export QCC
export QCCDEFS
$(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
@ echo make[1]: Entering directory \`$(CURDIR)/client\'
- @ ./qcc.sh client $@ $<
+ @ ./tools/qcc.sh client $@ $<
-include $(WORKDIR)/client.d
$(PROGS_OUT)/progs.dat: server/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
@ echo make[1]: Entering directory \`$(CURDIR)/server\'
- @ ./qcc.sh server $@ $<
+ @ ./tools/qcc.sh server $@ $<
-include $(WORKDIR)/server.d
$(PROGS_OUT)/menu.dat: menu/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
@ echo make[1]: Entering directory \`$(CURDIR)/menu\'
- @ ./qcc.sh menu $@ $<
+ @ ./tools/qcc.sh menu $@ $<
-include $(WORKDIR)/menu.d
+++ /dev/null
-#!/bin/sh
-set -ex
-git checkout divVerent/autocvarizer_test
-trap 'git reset --hard; git checkout divVerent/autocvarizer' EXIT
-trap 'exit 1' INT
-git merge --no-commit -s ours divVerent/autocvarizer
-git read-tree -m -u divVerent/autocvarizer # "theirs"
-find server \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | AUTOCVARING_SVQC=1 xargs -0 perl autocvarize.pl > server/autocvars.qh.new
-diff -Nu server/autocvars.qh server/autocvars.qh.new || true
-mv server/autocvars.qh.new server/autocvars.qh
-find client \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | xargs -0 perl autocvarize.pl > client/autocvars.qh.new
-diff -Nu client/autocvars.qh client/autocvars.qh.new || true
-mv client/autocvars.qh.new client/autocvars.qh
-if make -C .. FTEQCC=../../../../fteqcc/fteqcc.bin FTEQCCFLAGS=; then
- echo "Commit? ^C to not"
- read -r L
- git add server/autocvars.qh
- git add client/autocvars.qh
- git commit -a
-else
- echo "FAILED. Exit this shell when done examining."
- sh -i
-fi
+++ /dev/null
-#!/usr/bin/perl
-# this tool generates JUST the autocvar declarations for cvars
-use strict;
-use warnings;
-
-my @files = @ARGV;
-
-my %cvars = ();
-my %old = ();
-my %menu = ();
-my %defaults = ();
-
-sub found($$$$)
-{
- my ($name, $type, $default, $force) = @_;
- if(length $name >= 55)
- {
- warn "cvar $name is a Dr. honorificabilitudinitatibis causa BRLOGENSHFEGLE";
- $type = 'cvar_toolong';
- return;
- }
-# $old{$name} = 1
-# if $force;
-# $menu{$name} = 1
-# if $force > 1;
- if(exists $cvars{$name} and not defined $cvars{name})
- {
- # have already warned
- }
- elsif(exists $cvars{$name} and $type ne $cvars{$name})
- {
- warn "cvar $name used with different types";
- if($force)
- {
- $defaults{$name} = $default;
- $cvars{$name} = $type;
- }
- else
- {
- undef $cvars{$name}
- unless $old{$name};
- }
- return;
- }
- elsif(exists $cvars{$name} and exists $defaults{$name} and $default ne $defaults{$name})
- {
- warn "cvar $name used with different defaults";
- if($force)
- {
- $defaults{$name} = $default;
- $cvars{$name} = $type;
- }
- else
- {
- undef $cvars{$name}
- unless $old{$name};
- }
- }
- else
- {
- $defaults{$name} = $default;
- $cvars{$name} = $type;
- }
-}
-
-for my $f(@files)
-{
- print STDERR "In file $f\n";
- open my $fh, "<", $f;
- while(<$fh>)
- {
- chomp;
- if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
- {
- next;
- }
- s/\/\/.*//;
- if(/^(?:var )?float autocvar_(\w+);$/)
- {
- found $1, 'cvar', 0, 1;
- next;
- }
- if(/^var float autocvar_(\w+) = (.*);$/)
- {
- found $1, 'cvar', $2, 1;
- next;
- }
- if(/^(?:var )?vector autocvar_(\w+);$/)
- {
- found $1, 'cvar_vector', "0 0 0", 1;
- next;
- }
- if(/^var vector autocvar_(\w+) = '(.*)';$/)
- {
- found $1, 'cvar_vector', $2, 1;
- next;
- }
- if(/^(?:var )?string autocvar_(\w+);$/)
- {
- found $1, 'cvar_string', "", 1;
- next;
- }
- if(/^var string autocvar_(\w+) = "(.*)";$/)
- {
- found $1, 'cvar_string', $2, 1;
- next;
- }
- if(/^#define autocvar_(\w+) cvar("\1")$/)
- {
- found $1, 'cvar', 0, 2;
- next;
- }
- if(/^#define autocvar_(\w+) cvar_or("\1", (.*))$/)
- {
- found $1, 'cvar', $1, 2;
- next;
- }
- if(/^#define autocvar_(\w+) cvar_string("\1")$/)
- {
- found $1, 'cvar_string', "", 2;
- next;
- }
- while(/\bcvar\s*\(\s*"(\w+)"\s*\)/g)
- {
- found $1, 'cvar', 0, 0;
- }
- while(/\bcvar_string\s*\(\s*"(\w+)"\s*\)/g)
- {
- found $1, 'cvar_string', "", 0;
- }
- while(/\bcvar_vector\s*\(\s*"(\w+)"\s*\)/g)
- {
- found $1, 'cvar_vector', "0 0 0", 0;
- }
- while(/\bcvar_or\s*\(\s*"(\w+)"\s*,\s*([^\s)]+)\s*\)/g)
- {
- found $1, 'cvar', $2, 0;
- }
- }
-}
-
-if($ENV{AUTOCVARING_SVQC})
-{
- for my $f(<menu/xonotic/*.c>)
- {
- print STDERR "In file $f\n";
- open my $fh, "<", $f;
- while(<$fh>)
- {
- for(/"([^"]*)"/g)
- {
- $menu{$1} = 1;
- }
- }
- }
-
- for my $f(<../maps/campaign*.txt>)
- {
- print STDERR "In file $f\n";
- open my $fh, "<", $f;
- while(<$fh>)
- {
- for(/\b(.+?)\b/g)
- {
- $menu{$1} = 1;
- }
- }
- }
-}
-
-for my $name(sort keys %cvars)
-{
- my $type = $cvars{$name};
- my $menu = $menu{$name};
- my $default = $defaults{$name};
- die "wtf" if $name =~ /\0/;
- if(not defined $type)
- {
- print "// cannot declare $name, it is used with different types\n";
- }
- elsif($type eq 'cvar_toolong')
- {
- print "// cannot declare $name, name is too long\n";
- }
- elsif($type eq 'cvar' and not $menu and $default eq "0")
- {
- print "float autocvar_$name;\n";
- }
- elsif($type eq 'cvar' and not $menu and $default ne "0")
- {
- print "var float autocvar_$name = $default;\n";
- }
- elsif($type eq 'cvar_vector' and not $menu and $default eq "0 0 0")
- {
- print "vector autocvar_$name;\n";
- }
- elsif($type eq 'cvar_vector' and not $menu and $default ne "0 0 0")
- {
- print "var vector autocvar_$name = '$default';\n";
- }
- elsif($type eq 'cvar_string' and not $menu and $default eq "")
- {
- print "string autocvar_$name;\n";
- }
- elsif($type eq 'cvar_string' and not $menu and $default ne "")
- {
- print "var string autocvar_$name = \"$default\";\n";
- }
- elsif($type eq 'cvar' and $menu and $default eq "0")
- {
- print "#define autocvar_$name cvar(\"$name\")\n";
- }
- elsif($type eq 'cvar' and $menu and $default ne "0")
- {
- print "#define autocvar_$name cvar_or(\"$name\", \"$default\")\n";
- }
- elsif($type eq 'cvar_string' and $menu) # sorry, no cvar_or for these
- {
- print "#define autocvar_$name cvar_string(\"$name\")\n";
- }
- elsif($type eq 'cvar_vector' and $menu) # sorry, no cvar_or for these
- {
- print "#define autocvar_$name cvar_vector(\"$name\")\n";
- }
-}
-
-for my $f(@files)
-{
- print STDERR "In file $f\n";
- open my $fh, "<", $f;
- my $out = "";
- while(<$fh>)
- {
- chomp;
- if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
- {
- $out .= "$_\n";
- next;
- }
- if(/^(?:var )?float autocvar_(.*);$/)
- {
- $out .= "$_\n";
- next;
- }
- if(/^(?:var )?string autocvar_(.*);$/)
- {
- $out .= "$_\n";
- next;
- }
- if(/^#define autocvar_(.*) cvar/)
- {
- $out .= "$_\n";
- next;
- }
- s{\b(cvar|cvar_string|cvar_vector|cvar_or)\s*\(\s*"([^"]+)"\s*(?:,\s*[^\s)]+\s*)?\)}{
- my ($type, $name) = ($1, $2);
- $type = 'cvar' if $type eq 'cvar_or';
- my $realtype = $cvars{$name};
- my $r = $&;
- if(defined $realtype)
- {
- #$r = "$realtype(\"$name\")";
- $r = "autocvar_$name";
- if($type eq 'cvar' && $realtype eq 'cvar_string')
- {
- $r = "stof($r)";
- }
- if($type eq 'cvar_string' && $realtype eq 'cvar')
- {
- $r = "ftos($r)";
- }
- }
- $r;
- }ge;
- $out .= "$_\n";
- }
- close $fh;
- open $fh, ">", $f;
- print $fh $out;
- close $fh;
-}
-#ifndef CLIENT_ALL_H
-#define CLIENT_ALL_H
+#pragma once
#include <common/util.qh>
#include "defs.qh"
#include "main.qh"
#include "miscfunctions.qh"
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "announcer.qc"
+#include "bgmscript.qc"
+#include "csqcmodel_hooks.qc"
+#include "main.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "player_skeleton.qc"
+#include "scoreboard.qc"
+#include "shownames.qc"
+#include "teamradar.qc"
+#include "view.qc"
+#include "wall.qc"
if(roundstarttime == starttime)
{
Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_ROUNDSTART, countdown_rounded);
- Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded));
+ Notification annce_num = Announcer_PickNumber(CNT_ROUNDSTART, countdown_rounded);
+ if(annce_num != NULL)
+ Local_Notification(MSG_ANNCE, annce_num);
}
else
{
Local_Notification(MSG_CENTER, CENTER_COUNTDOWN_GAMESTART, countdown_rounded);
- Local_Notification(MSG_ANNCE, Announcer_PickNumber(CNT_GAMESTART, countdown_rounded));
+ Notification annce_num = Announcer_PickNumber(CNT_GAMESTART, countdown_rounded);
+ if(annce_num != NULL)
+ Local_Notification(MSG_ANNCE, annce_num);
}
this.nextthink = (starttime - (countdown - 1));
previous_game_starttime = startTime;
}
+#define ANNOUNCER_CHECKMINUTE(minute) MACRO_BEGIN { \
+ if(announcer_##minute##min) { \
+ if(timeleft > minute * 60) \
+ announcer_##minute##min = false; \
+ } else { \
+ if(timeleft < minute * 60 && timeleft > minute * 60 - 1) { \
+ announcer_##minute##min = true; \
+ Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_##minute); \
+ } \
+ } \
+} MACRO_END
-// Plays the 1 minute or 5 minutes (of maptime) remaining sound, if client wants it
void Announcer_Time()
{
- float timelimit = STAT(TIMELIMIT);
- float timeleft = max(0, timelimit * 60 + STAT(GAMESTARTTIME) - time);
- float warmup_timeleft = 0;
-
+ float timeleft;
if(warmup_stage)
- if(autocvar_g_warmup_limit > 0)
- warmup_timeleft = max(0, autocvar_g_warmup_limit + STAT(GAMESTARTTIME) - time);
-
- // 5 minute check
- if(autocvar_cl_announcer_maptime >= 2)
{
- // make sure that after connect (and e.g. 4 minutes left) we will not get a wrong sound
- if(announcer_5min)
- {
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 300)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 300))
- announcer_5min = false;
- }
+ float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+ if(warmup_timelimit > 0)
+ timeleft = max(0, warmup_timelimit - time);
else
- {
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 300 && timeleft > 299)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 300 && warmup_timeleft > 299))
- {
- //if we're in warmup mode, check whether there's a warmup timelimit
- if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
- {
- announcer_5min = true;
- Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_5);
- }
- }
- }
+ timeleft = 0;
}
+ else
+ timeleft = max(0, STAT(TIMELIMIT) * 60 + STAT(GAMESTARTTIME) - time);
+
+ if(autocvar_cl_announcer_maptime >= 2)
+ ANNOUNCER_CHECKMINUTE(5);
- // 1 minute check
if((autocvar_cl_announcer_maptime == 1) || (autocvar_cl_announcer_maptime == 3))
- {
- if (announcer_1min)
- {
- if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timeleft > 60)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft > 60))
- announcer_1min = false;
- }
- else if(((!warmup_stage || autocvar_g_warmup_limit == 0) && timelimit > 0 && timeleft < 60)
- || (warmup_stage && autocvar_g_warmup_limit > 0 && warmup_timeleft < 60))
- {
- // if we're in warmup mode, check whether there's a warmup timelimit
- if(!(autocvar_g_warmup_limit == -1 && warmup_stage))
- {
- announcer_1min = true;
- Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_1);
- }
- }
- }
+ ANNOUNCER_CHECKMINUTE(1);
}
void Announcer()
-#ifndef CLIENT_ANNOUNCER_H
-#define CLIENT_ANNOUNCER_H
+#pragma once
void Announcer();
string AnnouncerOption();
-
-#endif
-#ifndef CLIENT_AUTOCVARS_H
-#define CLIENT_AUTOCVARS_H
+#pragma once
bool autocvar__con_chat_maximized;
bool autocvar__hud_configure;
float autocvar_cl_spawnzoom_factor = 2;
bool autocvar_cl_stripcolorcodes;
bool autocvar_cl_vehicles_alarm = true;
-bool autocvar_cl_vehicles_hud_tactical = 1;
+bool autocvar_cl_vehicles_hud_tactical = true;
float autocvar_cl_vehicles_hudscale = 0.5;
float autocvar_cl_vehicles_notify_time = 15;
float autocvar_cl_vehicles_crosshair_size = 0.5;
+bool autocvar_cl_vehicles_crosshair_colorize = true;
bool autocvar__vehicles_shownchasemessage;
bool autocvar_cl_velocityzoom_enabled;
float autocvar_cl_velocityzoom_factor;
int autocvar_ekg;
float autocvar_fov;
float autocvar_g_balance_damagepush_speedfactor;
-float autocvar_g_warmup_limit;
bool autocvar_hud_cursormode = true;
float autocvar_hud_colorflash_alpha;
bool autocvar_hud_configure_checkcollisions;
float autocvar_crosshair_rpc_size = 1;
int autocvar_cl_nade_timer;
bool autocvar_cl_items_nofade;
-#endif
-#ifndef CLIENT_BGMSCRIPT_H
-#define CLIENT_BGMSCRIPT_H
+#pragma once
entityclass(BGMScript);
class(BGMScript) .string bgmscript;
void BGMScript_InitEntity(entity e);
float doBGMScript(entity e);
#endif
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "cl_cmd.qc"
+#include "all.qh"
#include <common/command/all.qc>
-
-#include "cl_cmd.qc"
-#ifndef CLIENT_COMMANDS_ALL_H
-#define CLIENT_COMMANDS_ALL_H
+#pragma once
-#include <common/commands/all.qh>
+#include <common/command/all.qh>
#include "cl_cmd.qh"
-
-#endif
+#include "cl_cmd.qh"
// ==============================================
// CSQC client commands code, written by Samual
// Last updated: December 28th, 2011
void LocalCommand_blurtest(int request)
{
+ TC(int, request);
// Simple command to work with postprocessing temporarily... possibly completely pointless, the glsl shader is used for a real feature now...
// Anyway, to enable it, just compile the client with -DBLURTEST and then you can use the command.
void LocalCommand_boxparticles(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_create_scrshot_ent(int request)
{
+ TC(int, request);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_debugmodel(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_handlevote(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_hud(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_localprint(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_mv_download(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
void LocalCommand_sendcvar(int request, int argc)
{
+ TC(int, request); TC(int, argc);
switch (request)
{
case CMD_REQUEST_COMMAND:
{
string c = strtolower(argv(0));
FOREACH(CLIENT_COMMANDS, it.m_name == c, {
- it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+ it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
return true;
});
return false;
{
string c = strtolower(argv(1));
FOREACH(CLIENT_COMMANDS, it.m_name == c, {
- it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+ it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
return true;
});
return false;
-#ifndef CLIENT_COMMANDS_CL_CMD_H
-#define CLIENT_COMMANDS_CL_CMD_H
+#pragma once
void Cmd_HUD_SetFields(int);
void Cmd_HUD_Help();
ATTRIB(clientcommand_##id, m_description, string, description); \
ENDCLASS(clientcommand_##id) \
REGISTER(CLIENT_COMMANDS, CMD_CL, id, m_id, NEW(clientcommand_##id)); \
- METHOD(clientcommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+ METHOD(clientcommand_##id, m_invokecmd, void(clientcommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(CLIENT_COMMANDS_aliases) {
FOREACH(CLIENT_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_cl")));
}
-
-#endif
+++ /dev/null
-Credits go to Dresk for putting this CSQC scratch source together.
-
-and Urre :o
-#ifndef CLIENT_CSQC_CONSTANTS
-#define CLIENT_CSQC_CONSTANTS
+#pragma once
// Mask Constants (set .drawmask on entities; use R_AddEntities to add all entities based on mask)
const int MASK_ENGINE = BIT(0);
const int CAMERA_CHASE = 2;
const int EF_NOMODELFLAGS = BIT(23);
-
-#endif
+#include "csqcmodel_hooks.qh"
#include "mutators/events.qh"
#include "player_skeleton.qh"
#include "weapons/projectile.qh"
}
int CSQCPlayer_FallbackFrame(entity this, int f)
{
+ TC(int, f);
if(frameduration(this.modelindex, f) > 0)
return f; // goooooood
if(frameduration(this.modelindex, 1) <= 0)
}
}
-// FEATURE: EF_NODRAW workalike
-const int EF_BRIGHTFIELD = BIT(0);
-const int EF_BRIGHTLIGHT = BIT(2);
-const int EF_DIMLIGHT = BIT(3);
-const int EF_DOUBLESIDED = BIT(15);
-const int EF_NOSELFSHADOW = BIT(16);
-const int EF_DYNAMICMODELLIGHT = BIT(17);
-const int EF_RESTARTANIM_BIT = BIT(20);
-const int EF_TELEPORT_BIT = BIT(21);
-const int MF_ROCKET = BIT(0); // leave a trail
-const int MF_GRENADE = BIT(1); // leave a trail
-const int MF_GIB = BIT(2); // leave a trail
-const int MF_ROTATE = BIT(3); // rotate (bonus items)
-const int MF_TRACER = BIT(4); // green split trail
-const int MF_ZOMGIB = BIT(5); // small blood trail
-const int MF_TRACER2 = BIT(6); // orange split trail
-const int MF_TRACER3 = BIT(7); // purple trail
-.int csqcmodel_effects;
-.int csqcmodel_modelflags;
-.int csqcmodel_traileffect;
void CSQCModel_Effects_PreUpdate(entity this)
{
this.effects = this.csqcmodel_effects;
--- /dev/null
+#pragma once
+
+// FEATURE: EF_NODRAW workalike
+const int EF_BRIGHTFIELD = BIT(0);
+const int EF_BRIGHTLIGHT = BIT(2);
+const int EF_DIMLIGHT = BIT(3);
+const int EF_DOUBLESIDED = BIT(15);
+const int EF_NOSELFSHADOW = BIT(16);
+const int EF_DYNAMICMODELLIGHT = BIT(17);
+const int EF_RESTARTANIM_BIT = BIT(20);
+const int EF_TELEPORT_BIT = BIT(21);
+
+const int MF_ROCKET = BIT(0); // leave a trail
+const int MF_GRENADE = BIT(1); // leave a trail
+const int MF_GIB = BIT(2); // leave a trail
+const int MF_ROTATE = BIT(3); // rotate (bonus items)
+const int MF_TRACER = BIT(4); // green split trail
+const int MF_ZOMGIB = BIT(5); // small blood trail
+const int MF_TRACER2 = BIT(6); // orange split trail
+const int MF_TRACER3 = BIT(7); // purple trail
+
+.int csqcmodel_effects;
+.int csqcmodel_modelflags;
+.int csqcmodel_traileffect;
+
+void CSQCModel_Effects_Apply(entity this);
-#ifndef CLIENT_DEFS_H
-#define CLIENT_DEFS_H
+#pragma once
// Additional OPTIONAL Fields and Globals
//float intermission;
.bool csqcmodel_isdead; // used by shownames and miscfunctions (entcs_IsDead) to know when a player is dead
#define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "hud.qc"
+#include "hud_config.qc"
+++ /dev/null
-#include "hud.qc"
-#include "hud_config.qc"
#include <common/deathtypes/all.qh>
#include <common/items/all.qc>
#include <common/mapinfo.qh>
+#include <common/vehicles/all.qh>
#include <common/mutators/mutator/waypoints/all.qh>
#include <common/stats.qh>
#include <lib/csqcmodel/cl_player.qh>
-// TODO: remove
-#include <server/mutators/mutator/gamemode_ctf.qc>
+#include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
/*
float HUD_GetRowCount(int item_count, vector size, float item_aspect)
{
+ TC(int, item_count);
float aspect = size_y / size_x;
return bound(1, floor((sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) / 2), item_count);
}
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
{
+ TC(int, item_count);
float columns, rows;
float ratio, best_ratio = 0;
float best_columns = 1, best_rows = 1;
return eX * best_columns + eY * best_rows;
}
-// return the string of the onscreen race timer
-string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
-{
- string col;
- string timestr;
- string cpname;
- string lapstr;
- lapstr = "";
-
- if(theirtime == 0) // goal hit
- {
- if(mytime > 0)
- {
- timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
- col = "^1";
- }
- else if(mytime == 0)
- {
- timestr = "+0.0";
- col = "^3";
- }
- else
- {
- timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
- col = "^2";
- }
-
- if(lapdelta > 0)
- {
- lapstr = sprintf(_(" (-%dL)"), lapdelta);
- col = "^2";
- }
- else if(lapdelta < 0)
- {
- lapstr = sprintf(_(" (+%dL)"), -lapdelta);
- col = "^1";
- }
- }
- else if(theirtime > 0) // anticipation
- {
- if(mytime >= theirtime)
- timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
- else
- timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
- col = "^3";
- }
- else
- {
- col = "^7";
- timestr = "";
- }
-
- if(cp == 254)
- cpname = _("Start line");
- else if(cp == 255)
- cpname = _("Finish line");
- else if(cp)
- cpname = sprintf(_("Intermediate %d"), cp);
- else
- cpname = _("Finish line");
-
- if(theirtime < 0)
- return strcat(col, cpname);
- else if(theirname == "")
- return strcat(col, sprintf("%s (%s)", cpname, timestr));
- else
- return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
-}
-
-// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
-int race_CheckName(string net_name)
-{
- int i;
- for (i=RANKINGS_CNT-1;i>=0;--i)
- if(grecordholder[i] == net_name)
- return i+1;
- return 0;
-}
-
/*
==================
HUD panels
//basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag)
{
+ TC(bool, vertical); TC(int, drawflag);
if(!length_ratio || !theAlpha)
return;
if(length_ratio > 1)
void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag)
{
+ TC(int, drawflag);
if(!theAlpha)
return;
drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
}
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha, float fadelerp)
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
{
+ TC(bool, vertical); TC(int, icon_right_align);
vector newPos = '0 0 0', newSize = '0 0 0';
vector picpos, numpos;
drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
}
-void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha)
+void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha)
{
+ TC(bool, vertical); TC(int, icon_right_align);
DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0);
}
==================
*/
+void CSQC_BUMBLE_GUN_HUD();
+
void HUD_Vehicle()
{
if(autocvar__hud_configure) return;
bool HUD_Panel_CheckFlags(int showflags)
{
+ TC(int, showflags);
if ( HUD_Minigame_Showpanels() )
return showflags & PANEL_SHOW_MINIGAME;
if(intermission == 2)
-#ifndef CLIENT_HUD_H
-#define CLIENT_HUD_H
+#pragma once
#include <common/weapons/all.qh>
float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary);
void HUD_Radar_Hide_Maximized();
+float HUD_GetRowCount(int item_count, vector size, float item_aspect);
+vector HUD_Get_Num_Color (float x, float maxvalue);
+void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
+void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
+void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
+vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);
+
void HUD_Reset ();
void HUD_Main ();
+int race_CheckName(string net_name);
+string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname);
+
int vote_yescount;
int vote_nocount;
int vote_needed;
var void HUD_ModIcons_GameType(vector pos, vector size);
void HUD_ModIcons_SetFunc();
-#endif
void HUD_Panel_FirstInDrawQ(float id);
void reset_tab_panels()
{
- int i;
- for(i = 0; i < hud_panels_COUNT; ++i)
+ for (int i = 0; i < hud_panels_COUNT; ++i)
tab_panels[i] = world;
}
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
vector candidate_pos = '0 0 0';
const float LEVELS_NUM = 4;
float level_height = vid_conheight / LEVELS_NUM;
-:find_tab_panel
+LABEL(find_tab_panel)
level = floor(tab_panel_pos.y / level_height) * level_height; //starting level
candidate_pos.x = (!tab_backward) ? vid_conwidth : 0;
start_posX = tab_panel_pos.x;
-#ifndef CLIENT_HUD_CONFIG_H
-#define CLIENT_HUD_CONFIG_H
+#pragma once
const int S_MOUSE1 = 1;
const int S_MOUSE2 = 2;
void HUD_Configure_PostDraw();
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary);
-
-#endif
--- /dev/null
+#pragma once
+
+#include "hud.qh"
+#include "hud_config.qh"
+#include <client/mutators/events.qh>
--- /dev/null
+// generated file; do not modify
+#include "ammo.qc"
+#include "centerprint.qc"
+#include "chat.qc"
+#include "engineinfo.qc"
+#include "healtharmor.qc"
+#include "infomessages.qc"
+#include "minigame.qc"
+#include "modicons.qc"
+#include "notify.qc"
+#include "physics.qc"
+#include "powerups.qc"
+#include "pressedkeys.qc"
+#include "quickmenu.qc"
+#include "racetimer.qc"
+#include "radar.qc"
+#include "score.qc"
+#include "timer.qc"
+#include "vote.qc"
+#include "weapons.qc"
+#include "ammo.qh"
+
+#include <common/t_items.qh>
+
// Ammo (#1)
void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color)
void DrawAmmoItem(vector myPos, vector mySize, .int ammoType, bool isCurrent, bool isInfinite)
{
+ TC(bool, isCurrent); TC(bool, isInfinite);
if(ammoType == ammo_none)
return;
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "centerprint.qh"
+
+#include <client/scoreboard.qh>
+
// CenterPrint (#16)
const int CENTERPRINT_MAX_MSGS = 10;
void centerprint_generic(int new_id, string strMessage, float duration, int countdown_num)
{
+ TC(int, new_id); TC(int, countdown_num);
//printf("centerprint_generic(%d, '%s^7', %d, %d);\n", new_id, strMessage, duration, countdown_num);
int i, j;
centerprint_countdown_num[j] = countdown_num;
}
-void centerprint_kill(float id)
+void centerprint_kill(int id)
{
+ TC(int, id);
centerprint_generic(id, "", 0, 0);
}
void reset_centerprint_messages()
{
- int i;
- for (i=0; i<CENTERPRINT_MAX_MSGS; ++i)
+ for (int i=0; i<CENTERPRINT_MAX_MSGS; ++i)
{
centerprint_expire_time[i] = 0;
centerprint_time[i] = 1;
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "chat.qh"
/** Handle chat as a panel (#12) */
void HUD_Chat()
{
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "engineinfo.qh"
// Engine info panel (#13)
float prevfps;
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "healtharmor.qh"
+
+#include <common/deathtypes/all.qh>
+
/** Health/armor (#3) */
void HUD_HealthArmor()
{
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "infomessages.qh"
+
+#include <common/ent_cs.qh>
+#include <common/mapinfo.qh>
+
// Info messages panel (#14)
#define drawInfoMessage(s) MACRO_BEGIN { \
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "minigame.qh"
// Minigame
#include <common/minigames/cl_minigames_hud.qc>
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "modicons.qh"
+
+#include <common/mapinfo.qh>
+#include <common/ent_cs.qh>
+#include <server/mutators/mutator/gamemode_ctf.qh> // TODO: remove
+
// Mod icons panel (#10)
bool mod_active; // is there any active mod icon?
void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
{
+ TC(int, layout); TC(int, i);
int stat = -1;
string pic = "";
vector color = '0 0 0';
float race_status_time;
int race_status_prev;
string race_status_name_prev;
+
+// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
+int race_CheckName(string net_name)
+{
+ int i;
+ for (i=RANKINGS_CNT-1;i>=0;--i)
+ if(grecordholder[i] == net_name)
+ return i+1;
+ return 0;
+}
+
+void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)
+{
+ drawstring_aspect(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ if (f < 1) {
+ drawstring_aspect_expanding(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+ drawstring_aspect_expanding(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+ }
+}
+
void HUD_Mod_Race(vector pos, vector mySize)
{
mod_active = 1; // race should never hide the mod icons panel
entity me;
me = playerslots[player_localnum];
float score;
- float f; // yet another function has this
score = me.(scores[ps_primary]);
if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD
db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score));
if(autocvar_cl_autodemo_delete_keeprecords)
{
- f = autocvar_cl_autodemo_delete;
+ float f = autocvar_cl_autodemo_delete;
f &= ~1;
cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
}
textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize);
medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize);
}
+ vector textSize = eX * squareSize + eY * 0.25 * squareSize;
- f = time - crecordtime_change_time;
-
- if (f > 1) {
- drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- } else {
- drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect_expanding(pos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- drawstring_aspect_expanding(pos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- }
+ race_showTime(_("Personal best"), textPos, eY * 0.25 * squareSize, t, textSize, time - crecordtime_change_time);
// server record
t = race_server_record;
srecordtime_prev = t;
srecordtime_change_time = time;
}
- f = time - srecordtime_change_time;
- if (f > 1) {
- drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- } else {
- drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect_expanding(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- drawstring_aspect_expanding(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- }
+ textPos += eY * 0.5 * squareSize;
+ race_showTime(_("Server best"), textPos, eY * 0.25 * squareSize, t, textSize, time - srecordtime_change_time);
if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
race_status_time = time + 5;
void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, int layout, int i)
{
+ TC(int, layout); TC(int, i);
float stat = -1;
string pic = "";
vector color = '0 0 0';
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "notify.qh"
// Notification area (#4)
void HUD_Notify_Push(string icon, string attacker, string victim)
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "physics.qh"
+
+#include <common/mapinfo.qh>
+#include <lib/csqcmodel/cl_player.qh>
+
// Physics panel (#15)
vector acc_prevspeed;
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "powerups.qh"
+
+#include <common/items/all.qc>
+
// Powerups (#2)
// Powerup item fields (reusing existing fields)
int getPowerupItemAlign(int align, int column, int row, int columns, int rows, bool isVertical)
{
+ TC(int, align); TC(int, column); TC(int, row); TC(int, columns); TC(int, rows); TC(bool, isVertical);
if(align < 2)
return align;
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "pressedkeys.qh"
/** Draw pressed keys (#11) */
void HUD_PressedKeys()
{
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "quickmenu.qh"
// QuickMenu (#23)
-#include <client/quickmenu.qc>
+#include <common/ent_cs.qh>
+#include <client/hud/all.qh>
+#include <client/mapvoting.qh>
+
+// QUICKMENU_MAXLINES must be <= 10
+const int QUICKMENU_MAXLINES = 10;
+// visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
+string QuickMenu_Page_Command[QUICKMENU_MAXLINES];
+string QuickMenu_Page_Description[QUICKMENU_MAXLINES];
+int QuickMenu_Page_Command_Type[QUICKMENU_MAXLINES];
+int QuickMenu_Page_Entries;
+int QuickMenu_Page;
+int QuickMenu_Page_ActivatedEntry = -1;
+bool QuickMenu_Page_ActivatedEntry_Close;
+float QuickMenu_Page_ActivatedEntry_Time;
+bool QuickMenu_IsLastPage;
+// all the entries are loaded into QuickMenu_Buffer
+// each entry (submenu or command) is composed of 2 entries
+const int QUICKMENU_MAXENTRIES = 256;
+const int QUICKMENU_BUFFER_MAXENTRIES = 2 * QUICKMENU_MAXENTRIES;
+int QuickMenu_Buffer = -1;
+int QuickMenu_Buffer_Size;
+int QuickMenu_Buffer_Index;
+string QuickMenu_CurrentSubMenu;
+float QuickMenu_TimeOut;
+
+// QuickMenu_Buffer are labeled with these tags
+#define QM_TAG_TITLE "T"
+#define QM_TAG_SUBMENU "S"
+#define QM_TAG_COMMAND "C"
+#define QM_TAG_PLCOMMAND "P"
+
+#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
+#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
+
+// if s1 is not empty s will be displayed as command otherwise as submenu
+void QuickMenu_Page_LoadEntry(int i, string s, string s1)
+{
+ TC(int, i);
+ //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
+ if (QuickMenu_Page_Description[i])
+ strunzone(QuickMenu_Page_Description[i]);
+ QuickMenu_Page_Description[i] = strzone(s);
+ if (QuickMenu_Page_Command[i])
+ strunzone(QuickMenu_Page_Command[i]);
+ QuickMenu_Page_Command[i] = strzone(s1);
+}
+
+void QuickMenu_Page_ClearEntry(int i)
+{
+ TC(int, i);
+ if (QuickMenu_Page_Description[i])
+ strunzone(QuickMenu_Page_Description[i]);
+ QuickMenu_Page_Description[i] = string_null;
+ if (QuickMenu_Page_Command[i])
+ strunzone(QuickMenu_Page_Command[i]);
+ QuickMenu_Page_Command[i] = string_null;
+}
+
+float QuickMenu_Page_Load(string target_submenu, float new_page);
+void QuickMenu_Default(string submenu);
+bool QuickMenu_Open(string mode, string submenu)
+{
+ int fh = -1;
+ string s;
+
+ if(mode == "")
+ {
+ if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
+ mode = "default";
+ else
+ mode = "file";
+ }
+
+ if(mode == "file")
+ {
+ if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
+ LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
+ else
+ {
+ fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
+ if(fh < 0)
+ LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file);
+ }
+ if(fh < 0)
+ mode = "default";
+ }
+
+ if(mode == "default")
+ {
+ QuickMenu_Buffer = buf_create();
+ if(QuickMenu_Buffer < 0)
+ return false;
+
+ QuickMenu_Default(submenu);
+ }
+ else if(mode == "file")
+ {
+ QuickMenu_Buffer = buf_create();
+ if(QuickMenu_Buffer < 0)
+ {
+ fclose(fh);
+ return false;
+ }
+
+ QuickMenu_Buffer_Size = 0;
+ while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
+ {
+ // first skip invalid entries, so we don't check them anymore
+ float argc;
+ argc = tokenize_console(s);
+ if(argc == 0 || argv(0) == "")
+ continue;
+ if(argc == 1)
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+ else if(argc == 2)
+ {
+ if(argv(1) == "")
+ continue;
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
+ }
+ else if(argc == 3)
+ {
+ // check for special keywords
+ float teamplayers = 0, without_me = 0;
+ switch(argv(2))
+ {
+ case "ALLPLAYERS_BUT_ME": without_me = 1; // fall through
+ case "ALLPLAYERS": teamplayers = 0; break;
+ case "OWNTEAMPLAYERS_BUT_ME": without_me = 1; // fall through
+ case "OWNTEAMPLAYERS": teamplayers = 1; break;
+ case "ENEMYTEAMPLAYERS": teamplayers = 2; break;
+ default: continue;
+ }
+
+ if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES)
+ {
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); // put PLCOMMAND arguments in the title string
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, argv(1));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+ }
+ }
+ ++QuickMenu_Buffer_Size;
+ }
+ fclose(fh);
+ }
+ else
+ {
+ LOG_WARNINGF("Unrecognized mode %s\n", mode);
+ return false;
+ }
+
+ if (QuickMenu_Buffer_Size <= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ return false;
+ }
+
+ if(mode == "file")
+ QuickMenu_Page_Load(submenu, 0);
+ else
+ QuickMenu_Page_Load("", 0);
+
+ hud_panel_quickmenu = 1;
+ if(autocvar_hud_cursormode)
+ setcursormode(1);
+ hudShiftState = 0;
+
+ QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+ return true;
+}
+
+void QuickMenu_Buffer_Close()
+{
+ if (QuickMenu_Buffer >= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ QuickMenu_Buffer_Size = 0;
+ }
+}
+
+void QuickMenu_Close()
+{
+ if (QuickMenu_CurrentSubMenu)
+ strunzone(QuickMenu_CurrentSubMenu);
+ QuickMenu_CurrentSubMenu = string_null;
+ int i;
+ for (i = 0; i < QUICKMENU_MAXLINES; ++i)
+ QuickMenu_Page_ClearEntry(i);
+ QuickMenu_Page_Entries = 0;
+ hud_panel_quickmenu = 0;
+ mouseClicked = 0;
+ prevMouseClicked = 0;
+ QuickMenu_Buffer_Close();
+
+ if(autocvar_hud_cursormode)
+ if(!mv_active)
+ setcursormode(0);
+}
+
+// It assumes submenu open tag is already detected
+void QuickMenu_skip_submenu(string submenu)
+{
+ string s, z_submenu;
+ z_submenu = strzone(submenu);
+ for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = QuickMenu_Buffer_Get();
+ if(substring(s, 0, 1) != QM_TAG_SUBMENU)
+ continue;
+ if(substring(s, 1, -1) == z_submenu) // submenu end
+ break;
+ QuickMenu_skip_submenu(substring(s, 1, -1));
+ }
+ strunzone(z_submenu);
+}
+
+bool QuickMenu_IsOpened()
+{
+ return (QuickMenu_Page_Entries > 0);
+}
+
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me);
+bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, bool without_me)
+{
+ TC(int, teamplayers); TC(bool, without_me);
+ int i;
+ for(i = 0; i < QUICKMENU_MAXLINES; ++i)
+ QuickMenu_Page_ClearEntry(i);
+ QuickMenu_Buffer_Close();
+
+ QuickMenu_Buffer = buf_create();
+ if(QuickMenu_Buffer < 0)
+ return false;
+
+ HUD_Quickmenu_PlayerListEntries(cmd, teamplayers, without_me);
+
+ if(QuickMenu_Buffer_Size <= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ return false;
+ }
+ return true;
+}
+
+// new_page 0 means page 0, new_page != 0 means next page
+int QuickMenu_Buffer_Index_Prev;
+bool QuickMenu_Page_Load(string target_submenu, bool new_page)
+{
+ TC(bool, new_page);
+ string s = string_null, cmd = string_null, z_submenu;
+
+ if (new_page == 0)
+ QuickMenu_Page = 0;
+ else
+ ++QuickMenu_Page;
+
+ z_submenu = strzone(target_submenu);
+ if (QuickMenu_CurrentSubMenu)
+ strunzone(QuickMenu_CurrentSubMenu);
+ QuickMenu_CurrentSubMenu = strzone(z_submenu);
+
+ QuickMenu_IsLastPage = true;
+ QuickMenu_Page_Entries = 0;
+
+ QuickMenu_Buffer_Index = 0;
+ if (z_submenu != "")
+ {
+ // skip everything until the submenu open tag is found
+ for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = QuickMenu_Buffer_Get();
+ if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
+ {
+ // printf("^3 beginning of %s\n", z_submenu);
+ ++QuickMenu_Buffer_Index;
+ break; // target_submenu found!
+ }
+ // printf("^1 skipping %s\n", s);
+ }
+ if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
+ LOG_WARNINGF("Couldn't find submenu \"%s\"\n", z_submenu);
+ }
+
+ // only the last page can contain up to QUICKMENU_MAXLINES entries
+ // the other ones contain only (QUICKMENU_MAXLINES - 2) entries
+ // so that the panel can show an empty row and "Continue..."
+ float first_entry = QuickMenu_Page * (QUICKMENU_MAXLINES - 2);
+ int entry_num = 0; // counts entries in target_submenu
+ for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = QuickMenu_Buffer_Get();
+
+ if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
+ {
+ // printf("^3 end of %s\n", z_submenu);
+ break;
+ }
+
+ if(entry_num >= first_entry)
+ {
+ ++QuickMenu_Page_Entries;
+ if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES - 2)
+ QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
+ else if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES)
+ {
+ QuickMenu_Page_ClearEntry(QUICKMENU_MAXLINES - 1);
+ QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
+ QuickMenu_IsLastPage = false;
+ break;
+ }
+ }
+
+ // NOTE: entries are loaded starting from 1, not from 0
+ if(substring(s, 0, 1) == QM_TAG_SUBMENU)
+ {
+ if(entry_num >= first_entry)
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
+ QuickMenu_skip_submenu(substring(s, 1, -1));
+ }
+ else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
+ {
+ ++QuickMenu_Buffer_Index;
+ cmd = QuickMenu_Buffer_Get();
+ string command_code = substring(cmd, 0, 1);
+ if(command_code == QM_TAG_COMMAND)
+ cmd = substring(cmd, 1, -1);
+ else if(command_code == QM_TAG_PLCOMMAND)
+ {
+ // throw away the current quickmenu buffer and load a new one
+ cmd = substring(cmd, 1, -1);
+ strunzone(z_submenu);
+ if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
+ return QuickMenu_Page_Load("", 0);
+ QuickMenu_Close();
+ return false;
+ }
+
+ tokenize_console(cmd);
+ QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
+
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
+ }
+
+ ++entry_num;
+ }
+ strunzone(z_submenu);
+ if (QuickMenu_Page_Entries == 0)
+ {
+ QuickMenu_Close();
+ return false;
+ }
+ QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+ return true;
+}
+
+bool QuickMenu_ActionForNumber(int num)
+{
+ TC(int, num);
+ if (!QuickMenu_IsLastPage)
+ {
+ if (num < 0 || num >= QUICKMENU_MAXLINES)
+ return false;
+ if (num == QUICKMENU_MAXLINES - 1)
+ return false;
+ if (num == 0)
+ {
+ QuickMenu_Page_Load(QuickMenu_CurrentSubMenu, +1);
+ return false;
+ }
+ } else if (num <= 0 || num > QuickMenu_Page_Entries)
+ return false;
+
+ if (QuickMenu_Page_Command[num] != "")
+ {
+ localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
+ QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+ return true;
+ }
+ if (QuickMenu_Page_Description[num] != "")
+ QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
+ return false;
+}
+
+void QuickMenu_Page_ActiveEntry(int entry_num)
+{
+ TC(int, entry_num);
+ QuickMenu_Page_ActivatedEntry = entry_num;
+ QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
+ if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
+ {
+ bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
+ // toggle commands don't close the quickmenu
+ if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
+ QuickMenu_Page_ActivatedEntry_Close = false;
+ else
+ QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
+ }
+ else
+ QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
+}
+
+bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
+{
+ TC(int, bInputType);
+ // we only care for keyboard events
+ if(bInputType == 2)
+ return false;
+
+ if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
+ return false;
+
+ if(bInputType == 3)
+ {
+ mousepos.x = nPrimary;
+ mousepos.y = nSecondary;
+ return true;
+ }
+
+ // allow console bind to work
+ string con_keys;
+ float keys;
+ con_keys = findkeysforcommand("toggleconsole", 0);
+ keys = tokenize(con_keys); // findkeysforcommand returns data for this
+
+ bool hit_con_bind = false;
+ int i;
+ for (i = 0; i < keys; ++i)
+ {
+ if(nPrimary == stof(argv(i)))
+ hit_con_bind = true;
+ }
+
+ if(bInputType == 0) {
+ if(nPrimary == K_ALT) hudShiftState |= S_ALT;
+ if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
+ if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+ }
+ else if(bInputType == 1) {
+ if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
+ if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
+ if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+ }
+
+ if(nPrimary == K_ESCAPE)
+ {
+ if (bInputType == 1)
+ return true;
+ QuickMenu_Close();
+ }
+ else if(nPrimary >= '0' && nPrimary <= '9')
+ {
+ if (bInputType == 1)
+ return true;
+ QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
+ }
+ if(nPrimary == K_MOUSE1)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE1;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE1);
+ }
+ else if(nPrimary == K_MOUSE2)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE2;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE2);
+ }
+ else if(hit_con_bind)
+ return false;
+
+ return true;
+}
+
+void QuickMenu_Mouse()
+{
+ if(mv_active) return;
+
+ if(!mouseClicked)
+ if(prevMouseClicked & S_MOUSE2)
+ {
+ QuickMenu_Close();
+ return;
+ }
+
+ if(!autocvar_hud_cursormode)
+ {
+ mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
+
+ mousepos.x = bound(0, mousepos.x, vid_conwidth);
+ mousepos.y = bound(0, mousepos.y, vid_conheight);
+ }
+
+ HUD_Panel_UpdateCvars();
+
+ if(panel_bg_padding)
+ {
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
+ }
+
+ float first_entry_pos, entries_height;
+ vector fontsize;
+ fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
+ first_entry_pos = panel_pos.y + ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
+ entries_height = panel_size.y - ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y);
+
+ if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
+ {
+ float entry_num;
+ entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
+ if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
+ {
+ panel_pos.y = first_entry_pos + entry_num * fontsize.y;
+ vector color;
+ if(mouseClicked & S_MOUSE1)
+ color = '0.5 1 0.5';
+ else if(hudShiftState & S_CTRL)
+ color = '1 1 0.3';
+ else
+ color = '1 1 1';
+ drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
+
+ if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
+ QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
+ }
+ }
+
+ draw_cursor_normal(mousepos, '1 1 1', 0.8);
+
+ prevMouseClicked = mouseClicked;
+}
+
+void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
+{
+ string entry;
+ float offset;
+ float desc_width = panel_size.x;
+ if(option)
+ {
+ string pic = strcat(hud_skin_path, "/", option);
+ if(precache_pic(pic) == "")
+ pic = strcat("gfx/hud/default/", option);
+ vector option_size = '1 1 0' * fontsize.y * 0.8;
+ desc_width -= option_size.x;
+ drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
+ desc_width -= fontsize.x / 4;
+ }
+ entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
+ if (autocvar_hud_panel_quickmenu_align > 0)
+ {
+ float real_desc_width = stringwidth_colors(entry, fontsize);
+ offset = (desc_width - real_desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
+
+ if(option)
+ {
+ // when there's enough room align description regardless the checkbox
+ float extra_offset = (panel_size.x - desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
+ if(offset + real_desc_width + extra_offset < desc_width)
+ offset += extra_offset;
+ else
+ offset = max(0, desc_width - real_desc_width);
+ }
+ drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+ }
+ else
+ drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+}
+
+void HUD_QuickMenu()
+{
+ if(!autocvar__hud_configure)
+ {
+ if (hud_configure_prev && hud_configure_prev != -1)
+ QuickMenu_Close();
+
+ if(!hud_draw_maximized) return;
+ if(mv_active) return;
+ //if(!autocvar_hud_panel_quickmenu) return;
+ if(!hud_panel_quickmenu) return;
+
+ if(QuickMenu_TimeOut)
+ if(time > QuickMenu_TimeOut)
+ {
+ QuickMenu_Close();
+ return;
+ }
+ }
+ else
+ {
+ if(!QuickMenu_IsOpened())
+ {
+ QuickMenu_Page_Entries = 1;
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
+ ++QuickMenu_Page_Entries;
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
+ ++QuickMenu_Page_Entries;
+ // although real command doesn't matter here, it must not be empty
+ // otherwise the entry is displayed like a submenu
+ for (; QuickMenu_Page_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Page_Entries)
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Command%d"), QuickMenu_Page_Entries), "-");
+ ++QuickMenu_Page_Entries;
+ QuickMenu_Page_ClearEntry(QuickMenu_Page_Entries);
+ QuickMenu_IsLastPage = false;
+ }
+ }
+
+ HUD_Panel_UpdateCvars();
+
+ HUD_Panel_DrawBg(1);
+
+ if(panel_bg_padding)
+ {
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
+ }
+
+ int i;
+ vector fontsize;
+ string color;
+ fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
+
+ if (!QuickMenu_IsLastPage)
+ {
+ color = "^5";
+ HUD_Quickmenu_DrawEntry(panel_pos + eY * (panel_size.y - fontsize.y), sprintf("%d: %s%s", 0, color, _("Continue...")), string_null, fontsize);
+ }
+ else
+ panel_pos.y += ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
+
+ for (i = 1; i <= QuickMenu_Page_Entries; ++i) {
+ if (QuickMenu_Page_Description[i] == "")
+ break;
+ string option = string_null;
+ if (QuickMenu_Page_Command[i] == "")
+ color = "^4";
+ else
+ {
+ color = "^3";
+ if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
+ {
+ int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
+ if(end < 0)
+ tokenize_console(QuickMenu_Page_Command[i]);
+ else
+ tokenize_console(substring(QuickMenu_Page_Command[i], 0, end));
+
+ //if(argv(1) && argv(0) == "toggle") // already checked
+ {
+ // "enable feature xxx" "toggle xxx" (or "toggle xxx 1 0")
+ // "disable feature xxx" "toggle xxx 0 1"
+ float ON_value = 1, OFF_value = 0;
+ if(argv(2))
+ ON_value = stof(argv(2));
+
+ if(argv(3))
+ OFF_value = stof(argv(3));
+ else
+ OFF_value = !ON_value;
+
+ float value = cvar(argv(1));
+ if(value == ON_value)
+ option = "checkbox_checked";
+ else if(value == OFF_value)
+ option = "checkbox_empty";
+ else
+ option = "checkbox_undefined";
+ }
+ }
+ }
+ HUD_Quickmenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Page_Description[i]), option, fontsize);
+
+ if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
+ && QuickMenu_Page_ActivatedEntry == i)
+ drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
+
+ panel_pos.y += fontsize.y;
+ }
+
+ if(QuickMenu_Page_ActivatedEntry >= 0 && time >= QuickMenu_Page_ActivatedEntry_Time)
+ {
+ if(!QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
+ {
+ bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
+ if(f && QuickMenu_Page_ActivatedEntry_Close)
+ QuickMenu_Close();
+ }
+ else if(QuickMenu_Page_ActivatedEntry_Close)
+ QuickMenu_Close();
+ QuickMenu_Page_ActivatedEntry = -1;
+ QuickMenu_Page_ActivatedEntry_Time = 0;
+ }
+}
+
+
+#define QUICKMENU_SMENU(submenu,eng_submenu) { \
+ if(target_submenu == eng_submenu && target_submenu_found) \
+ return; /* target_submenu entries are now loaded, exit */ \
+ if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \
+ ++QuickMenu_Buffer_Size; \
+ if(target_submenu == eng_submenu && !target_submenu_found) { \
+ QuickMenu_Buffer_Size = 0; /* enable load of next entries */ \
+ target_submenu_found = true; \
+ } \
+}
+
+#define QUICKMENU_ENTRY(title,command) { \
+ if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
+ { \
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
+ ++QuickMenu_Buffer_Size; \
+ QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \
+ } \
+ ++QuickMenu_Buffer_Size; \
+}
+
+#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
+ if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
+ QUICKMENU_SMENU(submenu,eng_submenu) \
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
+ ++QuickMenu_Buffer_Size; \
+ QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
+ ++QuickMenu_Buffer_Size; \
+ QUICKMENU_SMENU(submenu,eng_submenu) \
+ } \
+}
+
+
+
+// useful to Translate a string inside the Command
+#define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
+ if(prvm_language == "en") \
+ QUICKMENU_ENTRY(title, sprintf(command, text)) \
+ else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
+ QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
+ else \
+ QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
+}
+
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me)
+{
+ TC(int, teamplayers); TC(bool, without_me);
+ entity pl;
+ if(teamplayers && !team_count)
+ return;
+
+ for(pl = players.sort_next; pl; pl = pl.sort_next)
+ {
+ if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
+ continue;
+ if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
+ continue;
+ if(without_me && pl.sv_entnum == player_localnum)
+ continue;
+ QUICKMENU_ENTRY(entcs_GetName(pl.sv_entnum), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
+ }
+
+ return;
+}
+
+
+// Specifying target_submenu, this function only loads entries inside target_submenu
+// NOTE: alternatively we could have loaded the whole default quickmenu and
+// then called QuickMenu_Page_Load(target_submenu, 0);
+// but this sytem is more reliable since we can always refer to target_submenu
+// with the English title even if a translation is active
+void QuickMenu_Default(string target_submenu)
+{
+ bool target_submenu_found = false;
+ if(target_submenu != "")
+ QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
+ QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
+
+ if(teamplay)
+ {
+ QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^quad soon")), "say_team %s", "quad soon", CTX(_("QMCMD^quad soon")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^free item, icon")), "say_team %s; g_waypointsprite_team_here_p", "free item %x^7 (l:%y^7)", CTX(_("QMCMD^free item %x^7 (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^took item, icon")), "say_team %s; g_waypointsprite_team_here", "took item (l:%l^7)", CTX(_("QMCMD^took item (l:%l^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^negative")), "say_team %s", "negative", CTX(_("QMCMD^negative")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^positive")), "say_team %s", "positive", CTX(_("QMCMD^positive")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^need help, icon")), "say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp", "need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^enemy seen, icon")), "say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming", "enemy seen (l:%y^7)", CTX(_("QMCMD^enemy seen (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^flag seen, icon")), "say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag", "flag seen (l:%y^7)", CTX(_("QMCMD^flag seen (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^defending, icon")), "say_team %s; g_waypointsprite_team_here", "defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^roaming, icon")), "say_team %s; g_waypointsprite_team_here", "roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^attacking, icon")), "say_team %s; g_waypointsprite_team_here", "attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^killed flag, icon")), "say_team %s; g_waypointsprite_team_here_p", "killed flagcarrier (l:%y^7)", CTX(_("QMCMD^killed flagcarrier (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^dropped flag, icon")), "say_team %s; g_waypointsprite_team_here_d", "dropped flag (l:%d^7)", CTX(_("QMCMD^dropped flag (l:%d^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop gun, icon")), "say_team %s; g_waypointsprite_team_here; wait; dropweapon", "dropped gun %w^7 (l:%l^7)", CTX(_("QMCMD^dropped gun %w^7 (l:%l^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop flag/key, icon")), "say_team %s; g_waypointsprite_team_here; wait; use", "dropped flag/key %w^7 (l:%l^7)", CTX(_("QMCMD^dropped flag/key %w^7 (l:%l^7)")))
+ QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
+ }
+
+ QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
+ QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Player models like mine")), "toggle cl_forceplayermodels")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Names above players")), "toggle hud_shownames")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Crosshair per weapon")), "toggle crosshair_per_weapon")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^FPS")), "toggle hud_panel_engineinfo")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Net graph")), "toggle shownetgraph")
+ QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Hit sound")), "toggle cl_hitsound")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Chat sound")), "toggle con_chatsound")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
+
+ if(spectatee_status > 0)
+ {
+ QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^1st person")), "chase_active 0; -use")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person around player")), "chase_active 1; +use")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person behind")), "chase_active 1; -use")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
+ }
+
+ if(spectatee_status == -1)
+ {
+ QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Increase speed")), "weapnext")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Decrease speed")), "weapprev")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision off")), "+use")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision on")), "-use")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
+ }
+
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
+ if(prvm_language != "en")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Restart the map")), "vcall restart")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^End match")), "vcall endmatch")
+ if(STAT(TIMELIMIT) > 0)
+ {
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Reduce match time")), "vcall reducematchtime")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Extend match time")), "vcall extendmatchtime")
+ }
+ if(teamplay)
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+
+ if(target_submenu != "" && !target_submenu_found)
+ {
+ LOG_WARNINGF("Couldn't find submenu \"%s\"\n", target_submenu);
+ if(prvm_language != "en")
+ LOG_WARNINGF("^3Warning: submenu must be in English\n", target_submenu);
+ QuickMenu_Buffer_Size = 0;
+ }
+}
+#undef QUICKMENU_SMENU
+#undef QUICKMENU_ENTRY
+#undef QUICKMENU_ENTRY_TC
--- /dev/null
+#pragma once
+#include "../panel.qh"
+
+bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
+bool QuickMenu_IsOpened();
+void QuickMenu_Mouse();
+#include "racetimer.qh"
+
+#include <common/mapinfo.qh>
+
/** Race timer (#8) */
+
+// return the string of the onscreen race timer
+string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
+{
+ TC(int, cp);
+ string col;
+ string timestr;
+ string cpname;
+ string lapstr;
+ lapstr = "";
+
+ if(theirtime == 0) // goal hit
+ {
+ if(mytime > 0)
+ {
+ timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
+ col = "^1";
+ }
+ else if(mytime == 0)
+ {
+ timestr = "+0.0";
+ col = "^3";
+ }
+ else
+ {
+ timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
+ col = "^2";
+ }
+
+ if(lapdelta > 0)
+ {
+ lapstr = sprintf(_(" (-%dL)"), lapdelta);
+ col = "^2";
+ }
+ else if(lapdelta < 0)
+ {
+ lapstr = sprintf(_(" (+%dL)"), -lapdelta);
+ col = "^1";
+ }
+ }
+ else if(theirtime > 0) // anticipation
+ {
+ if(mytime >= theirtime)
+ timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
+ else
+ timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
+ col = "^3";
+ }
+ else
+ {
+ col = "^7";
+ timestr = "";
+ }
+
+ if(cp == 254)
+ cpname = _("Start line");
+ else if(cp == 255)
+ cpname = _("Finish line");
+ else if(cp)
+ cpname = sprintf(_("Intermediate %d"), cp);
+ else
+ cpname = _("Finish line");
+
+ if(theirtime < 0)
+ return strcat(col, cpname);
+ else if(theirname == "")
+ return strcat(col, sprintf("%s (%s)", cpname, timestr));
+ else
+ return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
+}
+
void HUD_RaceTimer ()
{
if(!autocvar__hud_configure)
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "radar.qh"
+
+#include <common/ent_cs.qh>
+#include <common/mapinfo.qh>
+#include <client/mapvoting.qh>
+#include <client/teamradar.qh>
+#include <common/mutators/mutator/waypoints/all.qh>
+
// Radar (#6)
float HUD_Radar_Clickable()
void HUD_Radar_Show_Maximized(bool doshow,float clickable)
{
+ TC(bool, doshow);
hud_panel_radar_maximized = doshow;
hud_panel_radar_temp_hidden = 0;
}
-float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float HUD_Radar_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
if(!hud_panel_radar_maximized || !hud_panel_radar_mouse ||
autocvar__hud_configure || mv_active)
return false;
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "score.qh"
+
+#include <client/scoreboard.qh>
+#include <common/ent_cs.qh>
+#include <common/mapinfo.qh>
+
// Score (#7)
void HUD_UpdatePlayerTeams();
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "timer.qh"
void HUD_Timer()
{
if(!autocvar__hud_configure)
minutesLeft = floor(timeleft / 60);
+ float warmup_timeleft = 0;
+ if(warmup_stage)
+ {
+ float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+ if(warmup_timelimit > 0)
+ warmup_timeleft = max(0, warmup_timelimit - time);
+ else if(warmup_timelimit == 0)
+ warmup_timeleft = timeleft;
+ warmup_timeleft = ceil(warmup_timeleft);
+ }
+
vector timer_color;
if(minutesLeft >= 5 || warmup_stage || timelimit == 0) //don't use red or yellow in warmup or when there is no timelimit
timer_color = '1 1 1'; //white
else
timer_color = '1 0 0'; //red
- if (autocvar_hud_panel_timer_increment || timelimit == 0 || warmup_stage) {
+ if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
if (time < STAT(GAMESTARTTIME)) {
//while restart is still active, show 00:00
timer = seconds_tostring(0);
} else {
- elapsedTime = floor(time - STAT(GAMESTARTTIME)); //127
+ elapsedTime = floor(time - STAT(GAMESTARTTIME));
timer = seconds_tostring(elapsedTime);
}
} else {
- timer = seconds_tostring(timeleft);
+ if(warmup_stage)
+ timer = seconds_tostring(warmup_timeleft);
+ else
+ timer = seconds_tostring(timeleft);
}
drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "vote.qh"
+
+#include <common/mapinfo.qh>
+
/** Vote window (#9) */
void HUD_Vote()
{
--- /dev/null
+#pragma once
+#include "../panel.qh"
+#include "weapons.qh"
// Weapon icons (#0)
entity weaponorder[Weapons_MAX];
void weaponorder_swap(int i, int j, entity pass)
{
+ TC(int, i); TC(int, j);
entity h = weaponorder[i];
weaponorder[i] = weaponorder[j];
weaponorder[j] = h;
string weaponorder_cmp_str;
int weaponorder_cmp(int i, int j, entity pass)
{
+ TC(int, i); TC(int, j);
int ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].m_id), 0);
int aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].m_id), 0);
return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
void HUD_Weapons()
{
- SELFPARAM();
// declarations
WepSet weapons_stat = WepSet_GetFromStat();
int i;
--- /dev/null
+#pragma once
+#include "../panel.qh"
#include "hud/all.qh"
#include "mapvoting.qh"
#include "mutators/events.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
#include "scoreboard.qh"
#include "shownames.qh"
#include <common/t_items.qh>
.float has_team;
float SetTeam(entity o, int Team)
{
+ TC(int, Team);
devassert_once(Team);
entity tm;
if(teamplay)
// In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
// In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
-float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
return true;
-#ifndef CLIENT_MAIN_H
-#define CLIENT_MAIN_H
+#pragma once
#include <common/constants.qh>
#include <common/weapons/all.qh>
// --------------------------------------------------------------------------
// MENU Functionality
-const float DATABUF_PING = 0;
-#define DATABUF_CAPTURES (1*maxclients)
-#define DATABUF_DEATHS (2*maxclients)
-#define DATABUF_RETURNS (3*maxclients)
-
-#define DATABUF_NEXT (5*maxclients)
-
void setpredraw(entity this, void(entity) pdfunc);
// --------------------------------------------------------------------------
float view_quality;
int framecount;
.float health;
-
-#endif
string MapVote_FormatMapItem(int id, string map, float _count, float maxwidth, vector fontsize)
{
+ TC(int, id);
string pre, post;
pre = sprintf("%d. ", id+1);
if(mv_detail)
vector MapVote_RGB(int id)
{
+ TC(int, id);
if(!(mv_flags[id] & GTV_AVAILABLE))
return '1 1 1';
if(id == mv_ownvote)
void GameTypeVote_DrawGameTypeItem(vector pos, float maxh, float tsize, string gtype, string pic, float _count, int id)
{
+ TC(int, id);
// Find the correct alpha
float alpha;
if(!(mv_flags_start[id] & GTV_AVAILABLE))
void MapVote_DrawMapItem(vector pos, float isize, float tsize, string map, string pic, float _count, int id)
{
+ TC(int, id);
vector img_size = '0 0 0';
string label;
float text_size;
void MapVote_DrawAbstain(vector pos, float isize, float tsize, float _count, int id)
{
+ TC(int, id);
vector rgb;
float text_size;
string label;
vector MapVote_GridVec(vector gridspec, int i, int m)
{
+ TC(int, i); TC(int, m);
int r = i % m;
return
'1 0 0' * (gridspec.x * r)
draw_cursor_normal(mv_mousepos, '1 1 1', 1 - autocvar__menu_alpha);
}
-void Cmd_MapVote_MapDownload(float argc)
+void Cmd_MapVote_MapDownload(int argc)
{
+ TC(int, argc);
entity pak;
if(argc != 2 || !mv_pk3list)
void MapVote_CheckPK3(string pic, string pk3, int id)
{
+ TC(int, id);
entity pak;
pak = spawn();
pak.netname = pk3;
void MapVote_CheckPic(string pic, string pk3, int id)
{
+ TC(int, id);
// never try to retrieve a pic for the "don't care" 'map'
if(mv_abstain && id == mv_num_maps - 1)
return;
void MapVote_ReadOption(int i)
{
+ TC(int, i);
string map = strzone(ReadString());
string pk3 = strzone(ReadString());
int j = bound(0, ReadByte(), n_ssdirs - 1);
void GameTypeVote_ReadOption(int i)
{
+ TC(int, i);
string gt = strzone(ReadString());
mv_maps[i] = gt;
n_ssdirs = 0;
}
-void MapVote_SendChoice(float index)
+void MapVote_SendChoice(int index)
{
+ TC(int, index);
localcmd(strcat("\nimpulse ", ftos(index+1), "\n"));
}
int MapVote_MoveLeft(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = mv_num_maps - 1;
}
int MapVote_MoveRight(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = 0;
}
int MapVote_MoveUp(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = mv_num_maps - 1;
}
int MapVote_MoveDown(int pos)
{
+ TC(int, pos);
int imp;
if ( pos < 0 )
imp = 0;
return imp;
}
-float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
+ TC(int, bInputType);
float imp;
if (!mv_active)
-#ifndef CLIENT_MAPVOTING_H
-#define CLIENT_MAPVOTING_H
+#pragma once
#include <common/constants.qh>
void MapVote_Draw();
void Net_MapVote_Picture();
float mv_active;
-#endif
entity GetTeam(int Team, bool add)
{
+ TC(int, Team); TC(bool, add);
int num = (Team == NUM_SPECTATOR) ? 16 : Team;
if(teamslots[num])
return teamslots[num];
// decolorizes and team colors the player name when needed
string playername(string thename, float teamid)
{
+ TC(int, teamid);
string t;
if (teamplay)
{
}
/** engine callback */
-void URI_Get_Callback(int id, float status, string data)
+void URI_Get_Callback(int id, int status, string data)
{
+ TC(int, id); TC(int, status);
if(url_URI_Get_Callback(id, status, data))
{
// handled
-#ifndef CLIENT_MISCFUNCTIONS_H
-#define CLIENT_MISCFUNCTIONS_H
+#pragma once
entity players;
entity teams;
void Accuracy_LoadColors();
vector Accuracy_GetColor(float accuracy);
-
-#endif
--- /dev/null
+// generated file; do not modify
-#ifndef CLIENT_MUTATORS_EVENTS_H
-#define CLIENT_MUTATORS_EVENTS_H
+#pragma once
#include <common/mutators/base.qh>
/** also, argv() can be used */ i(int, cmd_argc) \
/**/
MUTATOR_HOOKABLE(HUD_Command, EV_HUD_Command);
-
-#endif
}
}
-void skel_set_boneabs(float s, float bone, vector absorg)
+void skel_set_boneabs(float s, int bone, vector absorg)
{
+ TC(int, bone);
vector absang = fixedvectoangles2(v_forward, v_up);
vector parentorg = skel_get_boneabs(s, skel_get_boneparent(s, bone));
}
}
-void skeleton_from_frames(entity e, float is_dead)
-{SELFPARAM();
+void skeleton_from_frames(entity e, bool is_dead)
+{
+ TC(bool, is_dead);
float m = e.modelindex;
if(!e.skeletonindex)
{
-#ifndef CLIENT_PLAYER_SKELETON
-#define CLIENT_PLAYER_SKELETON
+#pragma once
void free_skeleton_from_frames(entity e);
void skeleton_from_frames(entity e, float is_dead);
class(Skeleton) .float bone_aim[MAX_AIM_BONES];
class(Skeleton) .float bone_aimweight[MAX_AIM_BONES];
class(Skeleton) .float fixbone;
-#endif
-#include "../lib/_all.inc"
+#include <lib/_all.inc>
#include "_all.qh"
-#include "../common/effects/qc/all.qc"
+#include "_mod.inc"
+#include "commands/_mod.inc"
+#include "hud/_mod.inc"
+#include "mutators/_mod.inc"
+#include "weapons/_mod.inc"
-#include "announcer.qc"
-#include "bgmscript.qc"
-#include "csqcmodel_hooks.qc"
-#include "hud/all.qc"
-#include "main.qc"
-#include "mapvoting.qc"
-#include "miscfunctions.qc"
-#include "player_skeleton.qc"
-#include "scoreboard.qc"
-#include "shownames.qc"
-#include "teamradar.qc"
-#include "view.qc"
-#include "wall.qc"
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
-#include "commands/all.qc"
+#include <lib/csqcmodel/cl_model.qc>
+#include <lib/csqcmodel/cl_player.qc>
+#include <lib/csqcmodel/interpolate.qc>
-#include "weapons/projectile.qc" // TODO
-
-#include "../common/_all.inc"
-
-#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/client.qc"
-#include "../lib/warpzone/common.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>
#if BUILD_MOD
#include "../../mod/client/progs.inc"
+++ /dev/null
-#include "quickmenu.qh"
-
-#include "hud/all.qh"
-#include "mapvoting.qh"
-
-// QUICKMENU_MAXLINES must be <= 10
-const int QUICKMENU_MAXLINES = 10;
-// visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
-string QuickMenu_Page_Command[QUICKMENU_MAXLINES];
-string QuickMenu_Page_Description[QUICKMENU_MAXLINES];
-int QuickMenu_Page_Command_Type[QUICKMENU_MAXLINES];
-int QuickMenu_Page_Entries;
-int QuickMenu_Page;
-int QuickMenu_Page_ActivatedEntry = -1;
-bool QuickMenu_Page_ActivatedEntry_Close;
-float QuickMenu_Page_ActivatedEntry_Time;
-bool QuickMenu_IsLastPage;
-// all the entries are loaded into QuickMenu_Buffer
-// each entry (submenu or command) is composed of 2 entries
-const int QUICKMENU_MAXENTRIES = 256;
-const int QUICKMENU_BUFFER_MAXENTRIES = 2 * QUICKMENU_MAXENTRIES;
-int QuickMenu_Buffer = -1;
-int QuickMenu_Buffer_Size;
-int QuickMenu_Buffer_Index;
-string QuickMenu_CurrentSubMenu;
-float QuickMenu_TimeOut;
-
-// QuickMenu_Buffer are labeled with these tags
-#define QM_TAG_TITLE "T"
-#define QM_TAG_SUBMENU "S"
-#define QM_TAG_COMMAND "C"
-#define QM_TAG_PLCOMMAND "P"
-
-#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
-#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
-
-// if s1 is not empty s will be displayed as command otherwise as submenu
-void QuickMenu_Page_LoadEntry(int i, string s, string s1)
-{
- //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
- if (QuickMenu_Page_Description[i])
- strunzone(QuickMenu_Page_Description[i]);
- QuickMenu_Page_Description[i] = strzone(s);
- if (QuickMenu_Page_Command[i])
- strunzone(QuickMenu_Page_Command[i]);
- QuickMenu_Page_Command[i] = strzone(s1);
-}
-
-void QuickMenu_Page_ClearEntry(int i)
-{
- if (QuickMenu_Page_Description[i])
- strunzone(QuickMenu_Page_Description[i]);
- QuickMenu_Page_Description[i] = string_null;
- if (QuickMenu_Page_Command[i])
- strunzone(QuickMenu_Page_Command[i]);
- QuickMenu_Page_Command[i] = string_null;
-}
-
-float QuickMenu_Page_Load(string target_submenu, float new_page);
-void QuickMenu_Default(string submenu);
-bool QuickMenu_Open(string mode, string submenu)
-{
- int fh = -1;
- string s;
-
- if(mode == "")
- {
- if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
- mode = "default";
- else
- mode = "file";
- }
-
- if(mode == "file")
- {
- if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
- LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
- else
- {
- fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
- if(fh < 0)
- LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file);
- }
- if(fh < 0)
- mode = "default";
- }
-
- if(mode == "default")
- {
- QuickMenu_Buffer = buf_create();
- if(QuickMenu_Buffer < 0)
- return false;
-
- QuickMenu_Default(submenu);
- }
- else if(mode == "file")
- {
- QuickMenu_Buffer = buf_create();
- if(QuickMenu_Buffer < 0)
- {
- fclose(fh);
- return false;
- }
-
- QuickMenu_Buffer_Size = 0;
- while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
- {
- // first skip invalid entries, so we don't check them anymore
- float argc;
- argc = tokenize_console(s);
- if(argc == 0 || argv(0) == "")
- continue;
- if(argc == 1)
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
- else if(argc == 2)
- {
- if(argv(1) == "")
- continue;
- QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
- }
- else if(argc == 3)
- {
- // check for special keywords
- float teamplayers = 0, without_me = 0;
- switch(argv(2))
- {
- case "ALLPLAYERS_BUT_ME": without_me = 1; // fall through
- case "ALLPLAYERS": teamplayers = 0; break;
- case "OWNTEAMPLAYERS_BUT_ME": without_me = 1; // fall through
- case "OWNTEAMPLAYERS": teamplayers = 1; break;
- case "ENEMYTEAMPLAYERS": teamplayers = 2; break;
- default: continue;
- }
-
- if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES)
- {
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); // put PLCOMMAND arguments in the title string
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, argv(1));
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
- }
- }
- ++QuickMenu_Buffer_Size;
- }
- fclose(fh);
- }
- else
- {
- LOG_WARNINGF("Unrecognized mode %s\n", mode);
- return false;
- }
-
- if (QuickMenu_Buffer_Size <= 0)
- {
- buf_del(QuickMenu_Buffer);
- QuickMenu_Buffer = -1;
- return false;
- }
-
- if(mode == "file")
- QuickMenu_Page_Load(submenu, 0);
- else
- QuickMenu_Page_Load("", 0);
-
- hud_panel_quickmenu = 1;
- if(autocvar_hud_cursormode)
- setcursormode(1);
- hudShiftState = 0;
-
- QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
- return true;
-}
-
-void QuickMenu_Buffer_Close()
-{
- if (QuickMenu_Buffer >= 0)
- {
- buf_del(QuickMenu_Buffer);
- QuickMenu_Buffer = -1;
- QuickMenu_Buffer_Size = 0;
- }
-}
-
-void QuickMenu_Close()
-{
- if (QuickMenu_CurrentSubMenu)
- strunzone(QuickMenu_CurrentSubMenu);
- QuickMenu_CurrentSubMenu = string_null;
- int i;
- for (i = 0; i < QUICKMENU_MAXLINES; ++i)
- QuickMenu_Page_ClearEntry(i);
- QuickMenu_Page_Entries = 0;
- hud_panel_quickmenu = 0;
- mouseClicked = 0;
- prevMouseClicked = 0;
- QuickMenu_Buffer_Close();
-
- if(autocvar_hud_cursormode)
- if(!mv_active)
- setcursormode(0);
-}
-
-// It assumes submenu open tag is already detected
-void QuickMenu_skip_submenu(string submenu)
-{
- string s, z_submenu;
- z_submenu = strzone(submenu);
- for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
- {
- s = QuickMenu_Buffer_Get();
- if(substring(s, 0, 1) != QM_TAG_SUBMENU)
- continue;
- if(substring(s, 1, -1) == z_submenu) // submenu end
- break;
- QuickMenu_skip_submenu(substring(s, 1, -1));
- }
- strunzone(z_submenu);
-}
-
-bool QuickMenu_IsOpened()
-{
- return (QuickMenu_Page_Entries > 0);
-}
-
-void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, float without_me);
-bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, float without_me)
-{
- int i;
- for(i = 0; i < QUICKMENU_MAXLINES; ++i)
- QuickMenu_Page_ClearEntry(i);
- QuickMenu_Buffer_Close();
-
- QuickMenu_Buffer = buf_create();
- if(QuickMenu_Buffer < 0)
- return false;
-
- HUD_Quickmenu_PlayerListEntries(cmd, teamplayers, without_me);
-
- if(QuickMenu_Buffer_Size <= 0)
- {
- buf_del(QuickMenu_Buffer);
- QuickMenu_Buffer = -1;
- return false;
- }
- return true;
-}
-
-// new_page 0 means page 0, new_page != 0 means next page
-int QuickMenu_Buffer_Index_Prev;
-bool QuickMenu_Page_Load(string target_submenu, int new_page)
-{
- string s = string_null, cmd = string_null, z_submenu;
-
- if (new_page == 0)
- QuickMenu_Page = 0;
- else
- ++QuickMenu_Page;
-
- z_submenu = strzone(target_submenu);
- if (QuickMenu_CurrentSubMenu)
- strunzone(QuickMenu_CurrentSubMenu);
- QuickMenu_CurrentSubMenu = strzone(z_submenu);
-
- QuickMenu_IsLastPage = true;
- QuickMenu_Page_Entries = 0;
-
- QuickMenu_Buffer_Index = 0;
- if (z_submenu != "")
- {
- // skip everything until the submenu open tag is found
- for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
- {
- s = QuickMenu_Buffer_Get();
- if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
- {
- // printf("^3 beginning of %s\n", z_submenu);
- ++QuickMenu_Buffer_Index;
- break; // target_submenu found!
- }
- // printf("^1 skipping %s\n", s);
- }
- if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
- LOG_WARNINGF("Couldn't find submenu \"%s\"\n", z_submenu);
- }
-
- // only the last page can contain up to QUICKMENU_MAXLINES entries
- // the other ones contain only (QUICKMENU_MAXLINES - 2) entries
- // so that the panel can show an empty row and "Continue..."
- float first_entry = QuickMenu_Page * (QUICKMENU_MAXLINES - 2);
- int entry_num = 0; // counts entries in target_submenu
- for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
- {
- s = QuickMenu_Buffer_Get();
-
- if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
- {
- // printf("^3 end of %s\n", z_submenu);
- break;
- }
-
- if(entry_num >= first_entry)
- {
- ++QuickMenu_Page_Entries;
- if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES - 2)
- QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
- else if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES)
- {
- QuickMenu_Page_ClearEntry(QUICKMENU_MAXLINES - 1);
- QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
- QuickMenu_IsLastPage = false;
- break;
- }
- }
-
- // NOTE: entries are loaded starting from 1, not from 0
- if(substring(s, 0, 1) == QM_TAG_SUBMENU)
- {
- if(entry_num >= first_entry)
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
- QuickMenu_skip_submenu(substring(s, 1, -1));
- }
- else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
- {
- ++QuickMenu_Buffer_Index;
- cmd = QuickMenu_Buffer_Get();
- string command_code = substring(cmd, 0, 1);
- if(command_code == QM_TAG_COMMAND)
- cmd = substring(cmd, 1, -1);
- else if(command_code == QM_TAG_PLCOMMAND)
- {
- // throw away the current quickmenu buffer and load a new one
- cmd = substring(cmd, 1, -1);
- strunzone(z_submenu);
- if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
- return QuickMenu_Page_Load("", 0);
- QuickMenu_Close();
- return false;
- }
-
- tokenize_console(cmd);
- QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
-
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
- }
-
- ++entry_num;
- }
- strunzone(z_submenu);
- if (QuickMenu_Page_Entries == 0)
- {
- QuickMenu_Close();
- return false;
- }
- QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
- return true;
-}
-
-bool QuickMenu_ActionForNumber(int num)
-{
- if (!QuickMenu_IsLastPage)
- {
- if (num < 0 || num >= QUICKMENU_MAXLINES)
- return false;
- if (num == QUICKMENU_MAXLINES - 1)
- return false;
- if (num == 0)
- {
- QuickMenu_Page_Load(QuickMenu_CurrentSubMenu, +1);
- return false;
- }
- } else if (num <= 0 || num > QuickMenu_Page_Entries)
- return false;
-
- if (QuickMenu_Page_Command[num] != "")
- {
- localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
- QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
- return true;
- }
- if (QuickMenu_Page_Description[num] != "")
- QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
- return false;
-}
-
-void QuickMenu_Page_ActiveEntry(float entry_num)
-{
- QuickMenu_Page_ActivatedEntry = entry_num;
- QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
- if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
- {
- bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
- // toggle commands don't close the quickmenu
- if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
- QuickMenu_Page_ActivatedEntry_Close = false;
- else
- QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
- }
- else
- QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
-}
-
-bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary)
-{
- // we only care for keyboard events
- if(bInputType == 2)
- return false;
-
- if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
- return false;
-
- if(bInputType == 3)
- {
- mousepos.x = nPrimary;
- mousepos.y = nSecondary;
- return true;
- }
-
- // allow console bind to work
- string con_keys;
- float keys;
- con_keys = findkeysforcommand("toggleconsole", 0);
- keys = tokenize(con_keys); // findkeysforcommand returns data for this
-
- bool hit_con_bind = false;
- int i;
- for (i = 0; i < keys; ++i)
- {
- if(nPrimary == stof(argv(i)))
- hit_con_bind = true;
- }
-
- if(bInputType == 0) {
- if(nPrimary == K_ALT) hudShiftState |= S_ALT;
- if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
- if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
- }
- else if(bInputType == 1) {
- if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
- if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
- if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
- }
-
- if(nPrimary == K_ESCAPE)
- {
- if (bInputType == 1)
- return true;
- QuickMenu_Close();
- }
- else if(nPrimary >= '0' && nPrimary <= '9')
- {
- if (bInputType == 1)
- return true;
- QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
- }
- if(nPrimary == K_MOUSE1)
- {
- if(bInputType == 0) // key pressed
- mouseClicked |= S_MOUSE1;
- else if(bInputType == 1) // key released
- mouseClicked -= (mouseClicked & S_MOUSE1);
- }
- else if(nPrimary == K_MOUSE2)
- {
- if(bInputType == 0) // key pressed
- mouseClicked |= S_MOUSE2;
- else if(bInputType == 1) // key released
- mouseClicked -= (mouseClicked & S_MOUSE2);
- }
- else if(hit_con_bind)
- return false;
-
- return true;
-}
-
-void QuickMenu_Mouse()
-{
- if(mv_active) return;
-
- if(!mouseClicked)
- if(prevMouseClicked & S_MOUSE2)
- {
- QuickMenu_Close();
- return;
- }
-
- if(!autocvar_hud_cursormode)
- {
- mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
- mousepos.x = bound(0, mousepos.x, vid_conwidth);
- mousepos.y = bound(0, mousepos.y, vid_conheight);
- }
-
- HUD_Panel_UpdateCvars();
-
- if(panel_bg_padding)
- {
- panel_pos += '1 1 0' * panel_bg_padding;
- panel_size -= '2 2 0' * panel_bg_padding;
- }
-
- float first_entry_pos, entries_height;
- vector fontsize;
- fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
- first_entry_pos = panel_pos.y + ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
- entries_height = panel_size.y - ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y);
-
- if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
- {
- float entry_num;
- entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
- if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
- {
- panel_pos.y = first_entry_pos + entry_num * fontsize.y;
- vector color;
- if(mouseClicked & S_MOUSE1)
- color = '0.5 1 0.5';
- else if(hudShiftState & S_CTRL)
- color = '1 1 0.3';
- else
- color = '1 1 1';
- drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
-
- if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
- QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
- }
- }
-
- draw_cursor_normal(mousepos, '1 1 1', 0.8);
-
- prevMouseClicked = mouseClicked;
-}
-
-void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
-{
- string entry;
- float offset;
- float desc_width = panel_size.x;
- if(option)
- {
- string pic = strcat(hud_skin_path, "/", option);
- if(precache_pic(pic) == "")
- pic = strcat("gfx/hud/default/", option);
- vector option_size = '1 1 0' * fontsize.y * 0.8;
- desc_width -= option_size.x;
- drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
- desc_width -= fontsize.x / 4;
- }
- entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
- if (autocvar_hud_panel_quickmenu_align > 0)
- {
- float real_desc_width = stringwidth_colors(entry, fontsize);
- offset = (desc_width - real_desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
-
- if(option)
- {
- // when there's enough room align description regardless the checkbox
- float extra_offset = (panel_size.x - desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
- if(offset + real_desc_width + extra_offset < desc_width)
- offset += extra_offset;
- else
- offset = max(0, desc_width - real_desc_width);
- }
- drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
- }
- else
- drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
-}
-
-void HUD_QuickMenu()
-{
- if(!autocvar__hud_configure)
- {
- if (hud_configure_prev && hud_configure_prev != -1)
- QuickMenu_Close();
-
- if(!hud_draw_maximized) return;
- if(mv_active) return;
- //if(!autocvar_hud_panel_quickmenu) return;
- if(!hud_panel_quickmenu) return;
-
- if(QuickMenu_TimeOut)
- if(time > QuickMenu_TimeOut)
- {
- QuickMenu_Close();
- return;
- }
- }
- else
- {
- if(!QuickMenu_IsOpened())
- {
- QuickMenu_Page_Entries = 1;
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
- ++QuickMenu_Page_Entries;
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
- ++QuickMenu_Page_Entries;
- // although real command doesn't matter here, it must not be empty
- // otherwise the entry is displayed like a submenu
- for (; QuickMenu_Page_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Page_Entries)
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Command%d"), QuickMenu_Page_Entries), "-");
- ++QuickMenu_Page_Entries;
- QuickMenu_Page_ClearEntry(QuickMenu_Page_Entries);
- QuickMenu_IsLastPage = false;
- }
- }
-
- HUD_Panel_UpdateCvars();
-
- HUD_Panel_DrawBg(1);
-
- if(panel_bg_padding)
- {
- panel_pos += '1 1 0' * panel_bg_padding;
- panel_size -= '2 2 0' * panel_bg_padding;
- }
-
- int i;
- vector fontsize;
- string color;
- fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
-
- if (!QuickMenu_IsLastPage)
- {
- color = "^5";
- HUD_Quickmenu_DrawEntry(panel_pos + eY * (panel_size.y - fontsize.y), sprintf("%d: %s%s", 0, color, _("Continue...")), string_null, fontsize);
- }
- else
- panel_pos.y += ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
-
- for (i = 1; i <= QuickMenu_Page_Entries; ++i) {
- if (QuickMenu_Page_Description[i] == "")
- break;
- string option = string_null;
- if (QuickMenu_Page_Command[i] == "")
- color = "^4";
- else
- {
- color = "^3";
- if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
- {
- int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
- if(end < 0)
- tokenize_console(QuickMenu_Page_Command[i]);
- else
- tokenize_console(substring(QuickMenu_Page_Command[i], 0, end));
-
- //if(argv(1) && argv(0) == "toggle") // already checked
- {
- // "enable feature xxx" "toggle xxx" (or "toggle xxx 1 0")
- // "disable feature xxx" "toggle xxx 0 1"
- float ON_value = 1, OFF_value = 0;
- if(argv(2))
- ON_value = stof(argv(2));
-
- if(argv(3))
- OFF_value = stof(argv(3));
- else
- OFF_value = !ON_value;
-
- float value = cvar(argv(1));
- if(value == ON_value)
- option = "checkbox_checked";
- else if(value == OFF_value)
- option = "checkbox_empty";
- else
- option = "checkbox_undefined";
- }
- }
- }
- HUD_Quickmenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Page_Description[i]), option, fontsize);
-
- if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
- && QuickMenu_Page_ActivatedEntry == i)
- drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
-
- panel_pos.y += fontsize.y;
- }
-
- if(QuickMenu_Page_ActivatedEntry >= 0 && time >= QuickMenu_Page_ActivatedEntry_Time)
- {
- if(!QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
- {
- bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
- if(f && QuickMenu_Page_ActivatedEntry_Close)
- QuickMenu_Close();
- }
- else if(QuickMenu_Page_ActivatedEntry_Close)
- QuickMenu_Close();
- QuickMenu_Page_ActivatedEntry = -1;
- QuickMenu_Page_ActivatedEntry_Time = 0;
- }
-}
-
-
-#define QUICKMENU_SMENU(submenu,eng_submenu) { \
- if(target_submenu == eng_submenu && target_submenu_found) \
- return; /* target_submenu entries are now loaded, exit */ \
- if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \
- ++QuickMenu_Buffer_Size; \
- if(target_submenu == eng_submenu && !target_submenu_found) { \
- QuickMenu_Buffer_Size = 0; /* enable load of next entries */ \
- target_submenu_found = true; \
- } \
-}
-
-#define QUICKMENU_ENTRY(title,command) { \
- if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
- { \
- QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
- ++QuickMenu_Buffer_Size; \
- QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \
- } \
- ++QuickMenu_Buffer_Size; \
-}
-
-#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
- if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
- QUICKMENU_SMENU(submenu,eng_submenu) \
- QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
- ++QuickMenu_Buffer_Size; \
- QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
- ++QuickMenu_Buffer_Size; \
- QUICKMENU_SMENU(submenu,eng_submenu) \
- } \
-}
-
-
-
-// useful to Translate a string inside the Command
-#define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
- if(prvm_language == "en") \
- QUICKMENU_ENTRY(title, sprintf(command, text)) \
- else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
- QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
- else \
- QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
-}
-
-void HUD_Quickmenu_PlayerListEntries(string cmd, float teamplayers, float without_me)
-{
- entity pl;
- if(teamplayers && !team_count)
- return;
-
- for(pl = players.sort_next; pl; pl = pl.sort_next)
- {
- if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
- continue;
- if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
- continue;
- if(without_me && pl.sv_entnum == player_localnum)
- continue;
- QUICKMENU_ENTRY(entcs_GetName(pl.sv_entnum), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
- }
-
- return;
-}
-
-
-// Specifying target_submenu, this function only loads entries inside target_submenu
-// NOTE: alternatively we could have loaded the whole default quickmenu and
-// then called QuickMenu_Page_Load(target_submenu, 0);
-// but this sytem is more reliable since we can always refer to target_submenu
-// with the English title even if a translation is active
-void QuickMenu_Default(string target_submenu)
-{
- bool target_submenu_found = false;
- if(target_submenu != "")
- QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
- QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
-
- if(teamplay)
- {
- QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^quad soon")), "say_team %s", "quad soon", CTX(_("QMCMD^quad soon")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^free item, icon")), "say_team %s; g_waypointsprite_team_here_p", "free item %x^7 (l:%y^7)", CTX(_("QMCMD^free item %x^7 (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^took item, icon")), "say_team %s; g_waypointsprite_team_here", "took item (l:%l^7)", CTX(_("QMCMD^took item (l:%l^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^negative")), "say_team %s", "negative", CTX(_("QMCMD^negative")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^positive")), "say_team %s", "positive", CTX(_("QMCMD^positive")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^need help, icon")), "say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp", "need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^enemy seen, icon")), "say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming", "enemy seen (l:%y^7)", CTX(_("QMCMD^enemy seen (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^flag seen, icon")), "say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag", "flag seen (l:%y^7)", CTX(_("QMCMD^flag seen (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^defending, icon")), "say_team %s; g_waypointsprite_team_here", "defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^roaming, icon")), "say_team %s; g_waypointsprite_team_here", "roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^attacking, icon")), "say_team %s; g_waypointsprite_team_here", "attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^killed flag, icon")), "say_team %s; g_waypointsprite_team_here_p", "killed flagcarrier (l:%y^7)", CTX(_("QMCMD^killed flagcarrier (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^dropped flag, icon")), "say_team %s; g_waypointsprite_team_here_d", "dropped flag (l:%d^7)", CTX(_("QMCMD^dropped flag (l:%d^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop gun, icon")), "say_team %s; g_waypointsprite_team_here; wait; dropweapon", "dropped gun %w^7 (l:%l^7)", CTX(_("QMCMD^dropped gun %w^7 (l:%l^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop flag/key, icon")), "say_team %s; g_waypointsprite_team_here; wait; use", "dropped flag/key %w^7 (l:%l^7)", CTX(_("QMCMD^dropped flag/key %w^7 (l:%l^7)")))
- QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
- }
-
- QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
- QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
- QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Player models like mine")), "toggle cl_forceplayermodels")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Names above players")), "toggle hud_shownames")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Crosshair per weapon")), "toggle crosshair_per_weapon")
- QUICKMENU_ENTRY(CTX(_("QMCMD^FPS")), "toggle hud_panel_engineinfo")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Net graph")), "toggle shownetgraph")
- QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Hit sound")), "toggle cl_hitsound")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Chat sound")), "toggle con_chatsound")
- QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
-
- if(spectatee_status > 0)
- {
- QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
- QUICKMENU_ENTRY(CTX(_("QMCMD^1st person")), "chase_active 0; -use")
- QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person around player")), "chase_active 1; +use")
- QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person behind")), "chase_active 1; -use")
- QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
- }
-
- if(spectatee_status == -1)
- {
- QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Increase speed")), "weapnext")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Decrease speed")), "weapprev")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision off")), "+use")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision on")), "-use")
- QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
- }
-
- QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
- if(prvm_language != "en")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
- QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Restart the map")), "vcall restart")
- QUICKMENU_ENTRY(CTX(_("QMCMD^End match")), "vcall endmatch")
- if(STAT(TIMELIMIT) > 0)
- {
- QUICKMENU_ENTRY(CTX(_("QMCMD^Reduce match time")), "vcall reducematchtime")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Extend match time")), "vcall extendmatchtime")
- }
- if(teamplay)
- QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
- QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
-
- if(target_submenu != "" && !target_submenu_found)
- {
- LOG_WARNINGF("Couldn't find submenu \"%s\"\n", target_submenu);
- if(prvm_language != "en")
- LOG_WARNINGF("^3Warning: submenu must be in English\n", target_submenu);
- QuickMenu_Buffer_Size = 0;
- }
-}
-#undef QUICKMENU_SMENU
-#undef QUICKMENU_ENTRY
-#undef QUICKMENU_ENTRY_TC
+++ /dev/null
-#ifndef CLIENT_QUICKMENU_H
-#define CLIENT_QUICKMENU_H
-
-bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
-bool QuickMenu_IsOpened();
-void QuickMenu_Mouse();
-
-#endif
#include "scoreboard.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
#include "hud/all.qh"
-#include "../common/constants.qh"
-#include "../common/mapinfo.qh"
-#include "../common/minigames/cl_minigames.qh"
-#include "../common/stats.qh"
-#include "../common/teams.qh"
+#include <common/ent_cs.qh>
+#include <common/constants.qh>
+#include <common/mapinfo.qh>
+#include <common/minigames/cl_minigames.qh>
+#include <common/stats.qh>
+#include <common/teams.qh>
float scoreboard_alpha_bg;
float scoreboard_alpha_fg;
*/
}
-int HUD_CompareScore(float vl, float vr, int f)
+int HUD_CompareScore(int vl, int vr, int f)
{
+ TC(int, vl); TC(int, vr); TC(int, f);
if(f & SFL_ZERO_IS_WORST)
{
if(vl == 0 && vr != 0)
"+as/objectives +nb/faults +nb/goals +ka/pickups +ka/bckills +ka/bctime +ft/revivals " \
"-lms,rc,nb/score"
-void Cmd_HUD_SetFields(float argc)
+void Cmd_HUD_SetFields(int argc)
{
+ TC(int, argc);
int i, j, slash;
string str, pattern;
float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0;
if(str == strtolower(scores_label[j]))
goto found; // sorry, but otherwise fteqcc -O3 miscompiles this and warns about "unreachable code"
-:notfound
+LABEL(notfound)
if(str == "frags")
j = SP_FRAGS;
else
LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str);
continue;
}
-:found
+LABEL(found)
hud_field[hud_num_fields] = j;
if(j == ps_primary)
have_primary = 1;
float hud_field_icon2_alpha;
string HUD_GetField(entity pl, int field)
{
+ TC(int, field);
float tmp, num, denom;
int f;
string str;
string HUD_FixScoreboardColumnWidth(int i, string str)
{
+ TC(int, i);
float field, f;
vector sz;
field = hud_field[i];
return str;
}
-void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_self, int pl_number)
+void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, bool is_self, int pl_number)
{
+ TC(bool, is_self); TC(int, pl_number);
vector tmp, rgb;
rgb = Team_ColorRGB(pl.team);
string str;
float average_accuracy;
vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
{
- SELFPARAM();
WepSet weapons_stat = WepSet_GetFromStat();
WepSet weapons_inmap = WepSet_GetFromStat_InMap();
float initial_posx = pos.x;
pos.y += sb_heading_fontsize.y + hud_fontsize.y * 0.25;
// Draw the scoreboard
- vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale;
+ vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * ((autocvar_scoreboard_bg_scale > 0) ? autocvar_scoreboard_bg_scale : 0.25);
if(teamplay)
{
-#ifndef CLIENT_SCOREBOARD_H
-#define CLIENT_SCOREBOARD_H
+#pragma once
float xmin, xmax, ymin, ymax, sbwidth;
void HUD_UpdatePlayerPos(entity pl);
void HUD_UpdateTeamPos(entity Team);
float HUD_WouldDrawScoreboard();
-#endif
#include "hud/all.qh"
-#include "../common/constants.qh"
-#include "../common/mapinfo.qh"
-#include "../common/teams.qh"
+#include <common/ent_cs.qh>
+#include <common/constants.qh>
+#include <common/mapinfo.qh>
+#include <common/teams.qh>
-#include "../lib/csqcmodel/cl_model.qh"
+#include <lib/csqcmodel/cl_model.qh>
// this.isactive = player is in range and coordinates/status (health and armor) are up to date
// this.origin = player origin
void Draw_ShowNames_All()
{
+ SELFPARAM();
if (!autocvar_hud_shownames) return;
LL_EACH(shownames_ent, true, {
entity entcs = entcs_receiver(i);
}
make_impure(it);
assert(entcs.think, eprint(entcs));
- WITH(entity, self, entcs, entcs.think());
+ WITHSELF(entcs, entcs.think());
if (!entcs.has_origin) continue;
if (entcs.m_entcs_private)
{
-#ifndef CLIENT_SHOWNAMES_H
-#define CLIENT_SHOWNAMES_H
+#pragma once
entityclass(ShowNames);
class(ShowNames) .float healthvalue;
class(ShowNames) .float pointtime;
void Draw_ShowNames_All();
-
-#endif
void draw_teamradar_link(vector start, vector end, int colors)
{
+ TC(int, colors);
vector c0, c1, norm;
start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start));
-#ifndef CLIENT_TEAMRADAR_H
-#define CLIENT_TEAMRADAR_H
+#pragma once
const int MAX_TEAMRADAR_TIMES = 32;
void draw_teamradar_link(vector start, vector end, int colors);
void teamradar_loadcvars();
-
-#endif
+#include "view.qh"
#include "announcer.qh"
#include "hud/all.qh"
#include "mapvoting.qh"
#include "scoreboard.qh"
#include "shownames.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
#include "mutators/events.qh"
-#include "../common/anim.qh"
-#include "../common/constants.qh"
-#include "../common/debug.qh"
-#include "../common/mapinfo.qh"
+#include <common/animdecide.qh>
+#include <common/ent_cs.qh>
+#include <common/anim.qh>
+#include <common/constants.qh>
+#include <common/debug.qh>
+#include <common/mapinfo.qh>
#include <common/gamemodes/all.qh>
-#include "../common/physics/player.qh"
-#include "../common/stats.qh"
-#include "../common/triggers/target/music.qh"
-#include "../common/teams.qh"
+#include <common/physics/player.qh>
+#include <common/stats.qh>
+#include <common/triggers/target/music.qh>
+#include <common/teams.qh>
#include <common/vehicles/all.qh>
#include <common/weapons/all.qh>
-#include "../common/viewloc.qh"
-#include "../common/minigames/cl_minigames.qh"
-#include "../common/minigames/cl_minigames_hud.qh"
+#include <common/viewloc.qh>
+#include <common/minigames/cl_minigames.qh>
+#include <common/minigames/cl_minigames_hud.qh>
-#include "../lib/csqcmodel/cl_player.qh"
+#include <lib/csqcmodel/cl_player.qh>
+#include <lib/csqcmodel/cl_model.qh>
+#include "csqcmodel_hooks.qh"
-#include "../lib/warpzone/client.qh"
-#include "../lib/warpzone/common.qh"
+#include <lib/warpzone/client.qh>
+#include <lib/warpzone/common.qh>
#define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT)
vel = view.velocity;
else
{
- vector forward, right = '0 0 0', up = '0 0 0';
+ vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
MAKEVECTORS(makevectors, view_angles, forward, right, up);
vel.x = view.velocity * forward;
vel.y = view.velocity * right * -1;
if(autocvar_cl_followmodel_velocity_absolute)
{
vector fixed_gunorg;
- vector forward, right = '0 0 0', up = '0 0 0';
+ vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
MAKEVECTORS(makevectors, view_angles, forward, right, up);
fixed_gunorg.x = gunorg * forward;
fixed_gunorg.y = gunorg * right * -1;
{
static string name_last;
string name = wep.mdl;
- if (name != name_last)
+ bool swap = name != name_last;
+ // if (swap)
{
name_last = name;
- CL_WeaponEntity_SetModel(this, name);
+ CL_WeaponEntity_SetModel(this, name, swap);
this.viewmodel_origin = this.origin;
this.viewmodel_angles = this.angles;
}
anim_set(this, this.anim_idle, true, false, false);
}
float f = 0; // 0..1; 0: fully active
- float eta = (this.weapon_nextthink - time) / STAT(WEAPONRATEFACTOR);
+ float rate = STAT(WEAPONRATEFACTOR);
+ float eta = rate ? ((this.weapon_nextthink - time) / rate) : 0;
if (eta <= 0) f = this.weapon_eta_last;
else switch (this.state)
{
}
}
-void HUD_Crosshair()
-{SELFPARAM();
+vector crosshair_getcolor(entity this, float health_stat)
+{
static float rainbow_last_flicker;
static vector rainbow_prev_color;
+ vector wcross_color = '0 0 0';
+ switch(autocvar_crosshair_color_special)
+ {
+ case 1: // crosshair_color_per_weapon
+ {
+ if(this)
+ {
+ wcross_color = this.wpcolor;
+ break;
+ }
+ else { goto normalcolor; }
+ }
+
+ case 2: // crosshair_color_by_health
+ {
+ float x = health_stat;
+
+ //x = red
+ //y = green
+ //z = blue
+
+ wcross_color.z = 0;
+
+ if(x > 200)
+ {
+ wcross_color.x = 0;
+ wcross_color.y = 1;
+ }
+ else if(x > 150)
+ {
+ wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
+ wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
+ }
+ else if(x > 100)
+ {
+ wcross_color.x = 1 - (x-100)*0.02 * 0.6;
+ wcross_color.y = 1 - (x-100)*0.02 * 0.1;
+ wcross_color.z = 1 - (x-100)*0.02;
+ }
+ else if(x > 50)
+ {
+ wcross_color.x = 1;
+ wcross_color.y = 1;
+ wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
+ }
+ else if(x > 20)
+ {
+ wcross_color.x = 1;
+ wcross_color.y = (x-20)*90/27/100;
+ wcross_color.z = (x-20)*90/27/100 * 0.2;
+ }
+ else
+ {
+ wcross_color.x = 1;
+ wcross_color.y = 0;
+ }
+ break;
+ }
+
+ case 3: // crosshair_color_rainbow
+ {
+ if(time >= rainbow_last_flicker)
+ {
+ rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
+ rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
+ }
+ wcross_color = rainbow_prev_color;
+ break;
+ }
+LABEL(normalcolor)
+ default: { wcross_color = stov(autocvar_crosshair_color); break; }
+ }
+
+ return wcross_color;
+}
+
+void HUD_Crosshair()
+{SELFPARAM();
entity e = this;
float f, i, j;
vector v;
wcross_name = strcat("gfx/crosshair", wcross_style);
// MAIN CROSSHAIR COLOR DECISION
- switch(autocvar_crosshair_color_special)
- {
- case 1: // crosshair_color_per_weapon
- {
- if(e)
- {
- wcross_color = e.wpcolor;
- break;
- }
- else { goto normalcolor; }
- }
-
- case 2: // crosshair_color_by_health
- {
- float x = STAT(HEALTH);
-
- //x = red
- //y = green
- //z = blue
-
- wcross_color.z = 0;
-
- if(x > 200)
- {
- wcross_color.x = 0;
- wcross_color.y = 1;
- }
- else if(x > 150)
- {
- wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
- wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
- }
- else if(x > 100)
- {
- wcross_color.x = 1 - (x-100)*0.02 * 0.6;
- wcross_color.y = 1 - (x-100)*0.02 * 0.1;
- wcross_color.z = 1 - (x-100)*0.02;
- }
- else if(x > 50)
- {
- wcross_color.x = 1;
- wcross_color.y = 1;
- wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
- }
- else if(x > 20)
- {
- wcross_color.x = 1;
- wcross_color.y = (x-20)*90/27/100;
- wcross_color.z = (x-20)*90/27/100 * 0.2;
- }
- else
- {
- wcross_color.x = 1;
- wcross_color.y = 0;
- }
- break;
- }
-
- case 3: // crosshair_color_rainbow
- {
- if(time >= rainbow_last_flicker)
- {
- rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
- rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
- }
- wcross_color = rainbow_prev_color;
- break;
- }
- :normalcolor
- default: { wcross_color = stov(autocvar_crosshair_color); break; }
- }
+ wcross_color = crosshair_getcolor(e, STAT(HEALTH));
if(autocvar_crosshair_effect_scalefade)
{
void WaypointSprite_Load();
void CSQC_UpdateView(float w, float h)
{SELFPARAM();
+ TC(int, w); TC(int, h);
entity e;
float fov;
float f;
if(!gen)
ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
}
- if(WantEventchase(self) || (!autocvar_cl_orthoview && ons_roundlost))
+ if(WantEventchase(this) || (!autocvar_cl_orthoview && ons_roundlost))
{
eventchase_running = true;
entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
if(!local_player)
- local_player = self; // fall back!
+ local_player = this; // fall back!
// make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
if(view_offset)
{
- WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+ WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, this);
if(trace_fraction == 1) { current_view_origin += view_offset; }
else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
}
makevectors(view_angles);
vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
- WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
+ WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
// If the boxtrace fails, revert back to line tracing.
if(!local_player.viewloc)
if(trace_startsolid)
{
eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
- WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+ WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
}
else { setproperty(VF_ORIGIN, trace_endpos); }
--- /dev/null
+#pragma once
+
+vector crosshair_getcolor(entity this, float health_stat);
-#ifndef CLIENT_WALL_H
-#define CLIENT_WALL_H
+#pragma once
entityclass(Wall);
class(Wall) .float lip;
void Ent_Wall_Draw(entity this);
void Ent_Wall_Remove(entity this);
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "projectile.qc"
void loopsound(entity e, int ch, string samp, float vol, float attn)
{
+ TC(int, ch);
if (e.silent)
return;
-#ifndef CLIENT_WEAPONS_PROJECTILE_H
-#define CLIENT_WEAPONS_PROJECTILE_H
+#pragma once
entityclass(Projectile);
class(Projectile).int traileffect;
void Ent_RemoveProjectile(entity this);
const int FL_PROJECTILE = BIT(15);
-
-#endif
+float autocvar_net_connecttimeout = 30;
+
#ifndef MENUQC
#include "anim.qc"
#include "animdecide.qc"
#include "t_items.qc"
#endif
-#include "items/all.qc"
+#include "items/_mod.inc"
#include "weapons/all.qc"
#include "monsters/all.qc"
#include "turrets/all.qc"
#include "vehicles/all.qc"
-#include "mutators/all.qc"
- #include "gamemodes/all.qc"
+#include "mutators/_mod.inc"
+ #include "gamemodes/_mod.inc"
--- /dev/null
+// generated file; do not modify
+#include "anim.qc"
+#include "animdecide.qc"
+#include "campaign_file.qc"
+#include "campaign_setup.qc"
+#include "ent_cs.qc"
+#include "mapinfo.qc"
+#include "net_notice.qc"
+#include "playerstats.qc"
+#include "state.qc"
+#include "t_items.qc"
+#include "util.qc"
+#include "viewloc.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "generic.qc"
+#include "markup.qc"
+#include "rpn.qc"
ATTRIB(genericcommand_##id, m_description, string, description); \
ENDCLASS(genericcommand_##id) \
REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
- METHOD(genericcommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+ METHOD(genericcommand_##id, m_invokecmd, void(genericcommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(GENERIC_COMMANDS_aliases) {
FOREACH(GENERIC_COMMANDS, true, localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu")));
CLASS(Command, Object)
ATTRIB(Command, m_name, string, string_null);
ATTRIB(Command, m_description, string, string_null);
- METHOD(Command, m_invokecmd, void(int request, entity caller, int arguments, string command)) { }
+ METHOD(Command, m_invokecmd, void(Command this, int request, entity caller, int arguments, string command))
+ {
+ TC(Command, this);
+ }
ENDCLASS(Command)
#endif
{
string c = strtolower(argv(0));
FOREACH(GENERIC_COMMANDS, it.m_name == c, {
- it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+ it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
return true;
});
return false;
{
string c = strtolower(argv(1));
FOREACH(GENERIC_COMMANDS, it.m_name == c, {
- it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+ it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
return true;
});
return false;
#ifndef COMMAND_GENERIC_H
#define COMMAND_GENERIC_H
-#include "../constants.qh"
+#include <common/constants.qh>
// =========================================================
// Declarations for common command code, written by Samual
if(argv(i) == argv(j))
goto skip_union;
s = strcat(s, " ", argv(i));
- :skip_union
+LABEL(skip_union)
}
if(substring(s, 0, 1) == " ")
s = substring(s, 1, 99999);
if(argv(i) == argv(j))
goto skip_difference;
s = strcat(s, " ", argv(i));
- :skip_difference
+LABEL(skip_difference)
}
if(substring(s, 0, 1) == " ")
s = substring(s, 1, 99999);
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
#ifndef DEATHTYPES_ALL_H
#define DEATHTYPES_ALL_H
-#include "../notifications/all.qh"
+#include <common/notifications/all.qh>
REGISTRY(Deathtypes, BITS(8))
#define Deathtypes_from(i) _Deathtypes_from(i, NULL)
#pragma once
+#ifdef CSQC
+.entity tag_entity;
+#endif
+
#ifndef MENUQC
.bool debug;
.int sv_entnum;
it.solid_prev = it.solid;
it.solid = SOLID_BBOX;
});
- vector forward; vector right; vector up;
+ vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0';
MAKEVECTORS(makevectors, it.v_angle, forward, right, up);
vector pos = it.origin + it.view_ofs;
traceline(pos, pos + forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, it);
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "effectinfo.qc"
FIELDS(MY)
#undef MY
- METHOD(EffectInfo, describe, string(EffectInfo this)) {
+ METHOD(EffectInfo, describe, string(EffectInfo this))
+ {
+ TC(EffectInfo, this);
string s = sprintf("SUB(%s) {\n", this.effectinfo_name);
#define str_bool(it) (it ? "true" : "false")
#define str_float(it) ftos(it)
return strcat(s, "}\n");
}
- METHOD(EffectInfo, dump, string(EffectInfo this)) {
+ METHOD(EffectInfo, dump, string(EffectInfo this))
+ {
+ TC(EffectInfo, this);
string s = sprintf("effect %s\n", this.effectinfo_name);
#define MY(f) this.effectinfo_##f
#define p(k, isset, parse, unparse) if (isset) { s = strcat(s, "\t", #k, unparse, "\n"); }
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "casings.qc"
+#include "damageeffects.qc"
+#include "gibs.qc"
+#include "globalsound.qc"
+#include "lightningarc.qc"
+#include "modeleffects.qc"
+#ifdef SVQC
+void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner);
+#endif
+
#ifdef IMPLEMENTATION
#include <common/util.qh>
{SELFPARAM();
// if particle distribution is enabled, slow ticrate by total number of damages
if(autocvar_cl_damageeffect_distribute)
- self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
+ this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
else
- self.nextthink = time + autocvar_cl_damageeffect_ticrate;
+ this.nextthink = time + autocvar_cl_damageeffect_ticrate;
- if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
+ if(time >= this.cnt || !this.owner || !this.owner.modelindex || !this.owner.drawmask)
{
// time is up or the player got gibbed / disconnected
- self.owner.total_damages = max(0, self.owner.total_damages - 1);
- remove(self);
+ this.owner.total_damages = max(0, this.owner.total_damages - 1);
+ remove(this);
return;
}
- if(self.state && !self.owner.csqcmodel_isdead)
+ if(this.state && !this.owner.csqcmodel_isdead)
{
// if the player was dead but is now alive, it means he respawned
// if so, clear his damage effects, or damages from his dead body will be copied back
- self.owner.total_damages = max(0, self.owner.total_damages - 1);
- remove(self);
+ this.owner.total_damages = max(0, this.owner.total_damages - 1);
+ remove(this);
return;
}
- self.state = self.owner.csqcmodel_isdead;
- if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum) && !autocvar_chase_active)
+ this.state = this.owner.csqcmodel_isdead;
+ if(this.owner.isplayermodel && (this.owner.entnum == player_localentnum) && !autocvar_chase_active)
return; // if we aren't using a third person camera, hide our own effects
// now generate the particles
vector org;
- org = gettaginfo(self, 0); // origin at attached location
- __pointparticles(self.team, org, '0 0 0', 1);
+ org = gettaginfo(this, 0); // origin at attached location
+ __pointparticles(this.team, org, '0 0 0', 1);
}
string species_prefix(int specnum)
}
}
-void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{SELFPARAM();
+void DamageEffect(entity this, vector hitorg, float thedamage, int type, int specnum)
+{
// particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
int nearestbone = 0;
if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage)
return;
- if(!self || !self.modelindex || !self.drawmask)
+ if(!this || !this.modelindex || !this.drawmask)
return;
// if this is a rigged mesh, the effect will show on the bone where damage was dealt
// we do this by choosing the skeletal bone closest to the impact, and attaching our entity to it
// if there's no skeleton, object origin will automatically be selected
- FOR_EACH_TAG(self)
+ FOR_EACH_TAG(this)
{
if(!tagnum)
continue; // skip empty bones
continue; // player model bone blacklist
// now choose the bone closest to impact origin
- if(nearestbone == 0 || vlen2(hitorg - gettaginfo(self, tagnum)) <= vlen2(hitorg - gettaginfo(self, nearestbone)))
+ if(nearestbone == 0 || vlen2(hitorg - gettaginfo(this, tagnum)) <= vlen2(hitorg - gettaginfo(this, nearestbone)))
nearestbone = tagnum;
}
- gettaginfo(self, nearestbone); // set gettaginfo_name
+ gettaginfo(this, nearestbone); // set gettaginfo_name
// return if we reached our damage effect limit or damages are disabled
// TODO: When the limit is reached, it would be better if the oldest damage was removed instead of not adding a new one
if(nearestbone)
{
- if(self.total_damages >= autocvar_cl_damageeffect_bones)
+ if(this.total_damages >= autocvar_cl_damageeffect_bones)
return; // allow multiple damages on skeletal models
}
else
{
- if(autocvar_cl_damageeffect < 2 || self.total_damages)
+ if(autocvar_cl_damageeffect < 2 || this.total_damages)
return; // allow a single damage on non-skeletal models
}
if(substring(effectname, strlen(effectname) - 5, 5) == "BLOOD")
{
- if(self.isplayermodel)
+ if(this.isplayermodel)
{
specstr = species_prefix(specnum);
specstr = substring(specstr, 0, strlen(specstr) - 1);
e = new(damage);
setmodel(e, MDL_Null); // necessary to attach and read origin
- setattachment(e, self, gettaginfo_name); // attach to the given bone
- e.owner = self;
+ setattachment(e, this, gettaginfo_name); // attach to the given bone
+ e.owner = this;
e.cnt = time + life;
e.team = _particleeffectnum(effectname);
e.think = DamageEffect_Think;
e.nextthink = time;
- self.total_damages += 1;
+ this.total_damages += 1;
}
NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
{
- make_pure(this);
+ const float ATTEN_LOW = 0.2;
float thedamage, rad, edge, thisdmg;
bool hitplayer = false;
int species, forcemul;
forcemul = 1;
FOREACH_ENTITY_RADIUS(w_org, rad + MAX_DAMAGEEXTRARADIUS, !it.tag_entity, {
- setself(it);
- vector nearest = NearestPointOnBox(self, w_org);
+ vector nearest = NearestPointOnBox(it, w_org);
if (rad)
{
- thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
+ thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
if(thisdmg >= 1)
continue;
if(thisdmg < 0)
if(thedamage)
{
thisdmg = thedamage + (edge - thedamage) * thisdmg;
- thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(self.origin - w_org);
+ thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(it.origin - w_org);
}
else
{
thisdmg = 0;
- thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
+ thisforce = forcemul * vlen(force) * normalize(it.origin - w_org);
}
}
else
{
- if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
+ if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
continue;
thisdmg = thedamage;
thisforce = forcemul * force;
}
- if(self.damageforcescale)
+ if(it.damageforcescale)
if(vdist(thisforce, !=, 0))
{
- self.move_velocity = self.move_velocity + damage_explosion_calcpush(self.damageforcescale * thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
- self.move_flags &= ~FL_ONGROUND;
+ it.move_velocity = it.move_velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.move_velocity, autocvar_g_balance_damagepush_speedfactor);
+ it.move_flags &= ~FL_ONGROUND;
}
if(w_issilent)
- self.silent = 1;
+ it.silent = 1;
- if(self.event_damage)
- self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
+ if(it.event_damage)
+ it.event_damage(it, thisdmg, w_deathtype, w_org, thisforce);
- DamageEffect(w_org, thisdmg, w_deathtype, species);
+ DamageEffect(it, w_org, thisdmg, w_deathtype, species);
- if(self.isplayermodel)
+ if(it.isplayermodel)
hitplayer = true; // this impact damaged a player
});
- setself(this);
if(DEATH_ISVEHICLE(w_deathtype))
{
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
switch(DEATH_ENT(w_deathtype))
{
// spiderbot
case DEATH_VH_SPID_MINIGUN:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_SPID_ROCKET:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_SPID_DEATH:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_GUN:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RACER_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RACER_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_ROCKET:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RACER_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RACER_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_DEATH:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_CANNON:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_FRAGMENT:
float i;
ang = vectoangles(vel);
RaptorCBShellfragToss(w_org, vel, ang + '0 0 1' * (120 * i));
}
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_BOMB:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_DEATH:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_BUMB_GUN:
- sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_BIGPLASMA_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_BIGPLASMA_IMPACT, this.origin, w_backoff * 1000, 1);
break;
}
}
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
switch(DEATH_ENT(w_deathtype))
{
case DEATH_TURRET_EWHEEL:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_BLASTER_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_BLASTER_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_FLAC:
pointparticles(EFFECT_HAGAR_EXPLODE, w_org, '0 0 0', 1);
- sound(self, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
+ sound(this, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
break;
case DEATH_TURRET_MLRS:
case DEATH_TURRET_HK:
case DEATH_TURRET_WALK_ROCKET:
case DEATH_TURRET_HELLION:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_MACHINEGUN:
case DEATH_TURRET_WALK_GUN:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_MACHINEGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_MACHINEGUN_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_PLASMA:
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_ELECTRO_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_ELECTRO_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_WALK_MELEE:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_TE_SPARK, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_TE_SPARK, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_PHASER:
break;
case DEATH_TURRET_TESLA:
- te_smallflash(self.origin);
+ te_smallflash(this.origin);
break;
}
w_backoff = trace_plane_normal;
else
w_backoff = -1 * normalize(force);
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
{
+#include "gibs.qh"
+
#ifdef IMPLEMENTATION
REGISTER_NET_TEMP(net_gibsplash)
void SUB_RemoveOnNoImpact()
{
+ SELFPARAM();
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
Gib_Delete(self);
}
--- /dev/null
+#pragma once
+
+#ifdef SVQC
+void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker);
+void Violence_GibSplash(entity source, float type, float amount, entity attacker);
+#endif
string GlobalSound_sample(string pair, float r);
#ifdef SVQC
- /** Use new sound handling. TODO: use when sounds play correctly on clients */
- bool autocvar_g_debug_globalsounds = false;
/**
* @param from the source entity, its position is sent
* @param gs the global sound def
* @param r a random number in 0..1
*/
- void globalsound(int channel, entity from, entity gs, float r, int chan, float vol, float atten)
+ void globalsound(int channel, entity from, entity gs, float r, int chan, float _vol, float _atten)
{
- assert(IS_PLAYER(from), eprint(from));
+ //assert(IS_PLAYER(from), eprint(from));
if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
if (!autocvar_g_debug_globalsounds) {
string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
switch (channel) {
case MSG_ONE:
- soundto(channel, from, chan, sample, vol, atten);
+ soundto(channel, from, chan, sample, _vol, _atten);
break;
case MSG_ALL:
- _sound(from, chan, sample, vol, atten);
+ _sound(from, chan, sample, _vol, _atten);
break;
}
return;
WriteByte(channel, r * 255);
WriteByte(channel, etof(from));
WriteByte(channel, chan);
- WriteByte(channel, floor(vol * 255));
- WriteByte(channel, floor(atten * 64));
+ WriteByte(channel, floor(_vol * 255));
+ WriteByte(channel, floor(_atten * 64));
entcs_force_origin(from);
vector o = from.origin + 0.5 * (from.mins + from.maxs);
WriteCoord(channel, o.x);
* @param ps the player sound def
* @param r a random number in 0..1
*/
- void playersound(int channel, entity from, entity ps, float r, int chan, float vol, float atten)
+ void playersound(int channel, entity from, entity ps, float r, int chan, float _vol, float _atten)
{
- assert(IS_PLAYER(from), eprint(from));
+ //assert(IS_PLAYER(from), eprint(from));
if (channel == MSG_ONE && !IS_REAL_CLIENT(msg_entity)) return;
if (!autocvar_g_debug_globalsounds) {
- UpdatePlayerSounds(from);
+ //UpdatePlayerSounds(from);
string s = from.(ps.m_playersoundfld);
string sample = GlobalSound_sample(s, r);
switch (channel) {
case MSG_ONE:
- soundto(channel, from, chan, sample, vol, atten);
+ soundto(channel, from, chan, sample, _vol, _atten);
break;
case MSG_ALL:
- _sound(from, chan, sample, vol, atten);
+ _sound(from, chan, sample, _vol, _atten);
break;
}
return;
WriteByte(channel, r * 255);
WriteByte(channel, etof(from));
WriteByte(channel, chan);
- WriteByte(channel, floor(vol * 255));
- WriteByte(channel, floor(atten * 64));
+ WriteByte(channel, floor(_vol * 255));
+ WriteByte(channel, floor(_atten * 64));
entcs_force_origin(from);
vector o = from.origin + 0.5 * (from.mins + from.maxs);
WriteCoord(channel, o.x);
return NULL;
}
- string allvoicesamples;
- STATIC_INIT(allvoicesamples)
- {
- FOREACH(PlayerSounds, it.instanceOfVoiceMessage, allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr));
- allvoicesamples = strzone(substring(allvoicesamples, 1, -1));
- }
-
.string _GetPlayerSoundSampleField(string type, bool voice)
{
GetPlayerSoundSampleField_notFound = false;
this.skin_for_playersound = this.skin;
ClearPlayerSounds(this);
LoadPlayerSounds(this, "sound/player/default.sounds", true);
- if (this.model == "null" || autocvar_g_debug_defaultsounds) return;
+ if (this.model == "null"
+ #ifdef SVQC
+ && autocvar_g_debug_globalsounds
+ #endif
+ ) return;
+ if (autocvar_g_debug_defaultsounds) return;
if (LoadPlayerSounds(this, get_model_datafilename(this.model, this.skin, "sounds"), false)) return;
LoadPlayerSounds(this, get_model_datafilename(this.model, 0, "sounds"), true);
}
#ifndef GLOBALSOUND_H
#define GLOBALSOUND_H
+#ifdef SVQC
+ /** Use new sound handling. TODO: use when sounds play correctly on clients */
+ bool autocvar_g_debug_globalsounds = false;
+#endif
+
// player sounds, voice messages
.string m_playersoundstr;
float LoadPlayerSounds(entity this, string f, bool strict);
void UpdatePlayerSounds(entity this);
//#endif
+entity GetVoiceMessage(string type);
#ifdef SVQC
#endif
+string allvoicesamples;
+STATIC_INIT(allvoicesamples)
+{
+ FOREACH(PlayerSounds, it.instanceOfVoiceMessage, allvoicesamples = strcat(allvoicesamples, " ", it.m_playersoundstr));
+ allvoicesamples = strzone(substring(allvoicesamples, 1, -1));
+}
+
#endif
+#include "lightningarc.qh"
+
#ifdef IMPLEMENTATION
REGISTER_NET_TEMP(TE_CSQC_ARC)
--- /dev/null
+#pragma once
+
+#ifdef SVQC
+void te_csqc_lightningarc(vector from, vector to);
+#endif
+#include "modeleffects.qh"
+
#ifdef IMPLEMENTATION
REGISTER_NET_LINKED(ENT_CLIENT_MODELEFFECT)
--- /dev/null
+#pragma once
+
+#ifdef SVQC
+void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector ang, vector angv, float s0, float s2, float a, float t1, float t2);
+#endif
void RubbleLimit(string cname, float limit, void(entity) deleteproc)
{
- SELFPARAM();
entity e;
entity oldest;
float c;
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITH(entity, self, this, this.think());
+ WITHSELF(this, this.think());
return true;
}
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
--- /dev/null
+// generated file; do not modify
+#include "nexball.qc"
+#include "weapon.qc"
}
}
-void nb_delayedinit()
+void nb_delayedinit(entity this)
{
if(find(world, classname, "nexball_team") == world)
nb_spawnteams();
if(!(ball = self.ballcarried))
return;
- W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0);
+ W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
if(trace_startsolid)
{
if(self.ballcarried.enemy)
{
entity _ball = self.ballcarried;
- W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0);
+ W_SetupShot(self, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
_ball.think = W_Nexball_Think;
_ball.nextthink = time;
if(!autocvar_g_nexball_tackling)
return;
- W_SetupShot(self, false, 2, SND(NB_SHOOT2), CH_WEAPON_A, 0);
+ W_SetupShot(self, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
entity missile = new(ballstealer);
missile.owner = self;
METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
{
+ SELFPARAM();
+ TC(BallStealer, thiswep);
if(fire & 1)
if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
if(autocvar_g_nexball_basketball_meter)
}
}
-METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
+METHOD(BallStealer, wr_setup, void(BallStealer this))
{
+ TC(BallStealer, this);
//weapon_setup(WEP_PORTO.m_id);
}
-METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer this))
{
+ TC(BallStealer, this);
return true;
}
-METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer this))
{
+ TC(BallStealer, this);
return true;
}
--- /dev/null
+// generated file; do not modify
+#include "cl_controlpoint.qc"
+#include "cl_generator.qc"
+#include "onslaught.qc"
+#include "sv_controlpoint.qc"
+#include "sv_generator.qc"
void ons_generator_ray_draw(entity this)
{
- if(time < self.move_time)
+ if(time < this.move_time)
return;
- self.move_time = time + 0.05;
+ this.move_time = time + 0.05;
- if(self.count > 10)
+ if(this.count > 10)
{
- remove(self);
+ remove(this);
return;
}
- if(self.count > 5)
- self.alpha -= 0.1;
+ if(this.count > 5)
+ this.alpha -= 0.1;
else
- self.alpha += 0.1;
+ this.alpha += 0.1;
- self.scale += 0.2;
- self.count +=1;
+ this.scale += 0.2;
+ this.count +=1;
}
void ons_generator_ray_spawn(vector org)
this.count -= 1;
}
-void generator_damage(float hp)
-{SELFPARAM();
+void generator_damage(entity this, float hp)
+{
if(hp <= 0)
- setmodel(self, MDL_ONS_GEN_DEAD);
- else if(hp < self.max_health * 0.10)
- setmodel(self, MDL_ONS_GEN9);
- else if(hp < self.max_health * 0.20)
- setmodel(self, MDL_ONS_GEN8);
- else if(hp < self.max_health * 0.30)
- setmodel(self, MDL_ONS_GEN7);
- else if(hp < self.max_health * 0.40)
- setmodel(self, MDL_ONS_GEN6);
- else if(hp < self.max_health * 0.50)
- setmodel(self, MDL_ONS_GEN5);
- else if(hp < self.max_health * 0.60)
- setmodel(self, MDL_ONS_GEN4);
- else if(hp < self.max_health * 0.70)
- setmodel(self, MDL_ONS_GEN3);
- else if(hp < self.max_health * 0.80)
- setmodel(self, MDL_ONS_GEN2);
- else if(hp < self.max_health * 0.90)
- setmodel(self, MDL_ONS_GEN1);
- else if(hp <= self.max_health || hp >= self.max_health)
- setmodel(self, MDL_ONS_GEN);
-
- setsize(self, GENERATOR_MIN, GENERATOR_MAX);
+ setmodel(this, MDL_ONS_GEN_DEAD);
+ else if(hp < this.max_health * 0.10)
+ setmodel(this, MDL_ONS_GEN9);
+ else if(hp < this.max_health * 0.20)
+ setmodel(this, MDL_ONS_GEN8);
+ else if(hp < this.max_health * 0.30)
+ setmodel(this, MDL_ONS_GEN7);
+ else if(hp < this.max_health * 0.40)
+ setmodel(this, MDL_ONS_GEN6);
+ else if(hp < this.max_health * 0.50)
+ setmodel(this, MDL_ONS_GEN5);
+ else if(hp < this.max_health * 0.60)
+ setmodel(this, MDL_ONS_GEN4);
+ else if(hp < this.max_health * 0.70)
+ setmodel(this, MDL_ONS_GEN3);
+ else if(hp < this.max_health * 0.80)
+ setmodel(this, MDL_ONS_GEN2);
+ else if(hp < this.max_health * 0.90)
+ setmodel(this, MDL_ONS_GEN1);
+ else if(hp <= this.max_health || hp >= this.max_health)
+ setmodel(this, MDL_ONS_GEN);
+
+ setsize(this, GENERATOR_MIN, GENERATOR_MAX);
}
-void generator_construct()
-{SELFPARAM();
- self.netname = "Generator";
- self.classname = "onslaught_generator";
-
- setorigin(self, self.origin);
- setmodel(self, MDL_ONS_GEN);
- setsize(self, GENERATOR_MIN, GENERATOR_MAX);
-
- self.move_movetype = MOVETYPE_NOCLIP;
- self.solid = SOLID_BBOX;
- self.movetype = MOVETYPE_NOCLIP;
- self.move_origin = self.origin;
- self.move_time = time;
- self.drawmask = MASK_NORMAL;
- self.alpha = 1;
- self.draw = generator_draw;
+void generator_construct(entity this)
+{
+ this.netname = "Generator";
+ this.classname = "onslaught_generator";
+
+ setorigin(this, this.origin);
+ setmodel(this, MDL_ONS_GEN);
+ setsize(this, GENERATOR_MIN, GENERATOR_MAX);
+
+ this.move_movetype = MOVETYPE_NOCLIP;
+ this.solid = SOLID_BBOX;
+ this.movetype = MOVETYPE_NOCLIP;
+ this.move_origin = this.origin;
+ this.move_time = time;
+ this.drawmask = MASK_NORMAL;
+ this.alpha = 1;
+ this.draw = generator_draw;
}
.vector glowmod;
-void generator_changeteam()
-{SELFPARAM();
- if(self.team)
+void generator_changeteam(entity this)
+{
+ if(this.team)
{
- self.glowmod = Team_ColorRGB(self.team - 1);
- self.teamradar_color = Team_ColorRGB(self.team - 1);
- self.colormap = 1024 + (self.team - 1) * 17;
+ this.glowmod = Team_ColorRGB(this.team - 1);
+ this.teamradar_color = Team_ColorRGB(this.team - 1);
+ this.colormap = 1024 + (this.team - 1) * 17;
}
else
{
- self.colormap = 1024;
- self.glowmod = '1 1 0';
- self.teamradar_color = '1 1 0';
+ this.colormap = 1024;
+ this.glowmod = '1 1 0';
+ this.teamradar_color = '1 1 0';
}
}
if(sf & GSF_SETUP)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
- setorigin(self, self.origin);
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
+ setorigin(this, this.origin);
- self.health = ReadByte();
- self.max_health = ReadByte();
- self.count = ReadByte();
- self.team = ReadByte();
+ this.health = ReadByte();
+ this.max_health = ReadByte();
+ this.count = ReadByte();
+ this.team = ReadByte();
- if(!self.count)
- self.count = 40;
+ if(!this.count)
+ this.count = 40;
- generator_changeteam();
- generator_construct();
+ generator_changeteam(this);
+ generator_construct(this);
}
if(sf & GSF_STATUS)
{
int _tmp;
_tmp = ReadByte();
- if(_tmp != self.team)
+ if(_tmp != this.team)
{
- self.team = _tmp;
- generator_changeteam();
+ this.team = _tmp;
+ generator_changeteam(this);
}
_tmp = ReadByte();
- if(_tmp != self.health)
- generator_damage(_tmp);
+ if(_tmp != this.health)
+ generator_damage(this, _tmp);
- self.health = _tmp;
+ this.health = _tmp;
}
}
.int havocbot_role_flags;
.float havocbot_attack_time;
-void havocbot_role_ons_defense();
-void havocbot_role_ons_offense();
-void havocbot_role_ons_assistant();
+void havocbot_role_ons_defense(entity this);
+void havocbot_role_ons_offense(entity this);
+void havocbot_role_ons_assistant(entity this);
-void havocbot_ons_reset_role(entity bot);
-void havocbot_goalrating_items(float ratingscale, vector org, float sradius);
-void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius);
+void havocbot_ons_reset_role(entity this);
+void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius);
+void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius);
// score rule declarations
const int ST_ONS_CAPS = 1;
self.nextthink = time;
}
-void ons_DelayedLinkSetup()
-{SELFPARAM();
+void ons_DelayedLinkSetup(entity this)
+{
self.goalentity = find(world, targetname, self.target);
self.enemy = find(world, targetname, self.target2);
if(!self.goalentity) { objerror("can not find target\n"); }
// Use targets now (somebody make sure this is in the right place..)
setself(this.owner);
activator = this;
- WITH(entity, self, this, SUB_UseTargets());
+ WITHSELF(this, SUB_UseTargets());
setself(this);
this.owner.waslinked = this.owner.islinked;
CSQCMODEL_AUTOUPDATE(this);
}
-void ons_DelayedControlPoint_Setup()
-{SELFPARAM();
+void ons_DelayedControlPoint_Setup(entity this)
+{
onslaught_updatelinks();
// captureshield setup
onslaught_updatelinks();
}
-void ons_DelayedGeneratorSetup()
-{SELFPARAM();
+void ons_DelayedGeneratorSetup(entity this)
+{
// bot waypoints
waypoint_spawnforitem_force(self, self.origin);
self.nearestwaypointtimeout = 0; // activate waypointing again
// NOTE: LEGACY CODE, needs to be re-written!
-void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_ons_offenseitems(entity this, float ratingscale, vector org, float sradius)
+{
entity head;
float t, c;
bool needarmor = false, needweapons = false;
// Needs armor/health?
- if(self.health<100)
+ if(this.health<100)
needarmor = true;
// Needs weapons?
c = 0;
FOREACH(Weapons, it != WEP_Null, {
- if(self.weapons & (it.m_wepset))
+ if(this.weapons & (it.m_wepset))
if(++c >= 4)
break;
});
if(!needweapons && !needarmor)
return;
- LOG_DEBUG(strcat(self.netname, " needs weapons ", ftos(needweapons) , "\n"));
- LOG_DEBUG(strcat(self.netname, " needs armor ", ftos(needarmor) , "\n"));
+ LOG_DEBUG(strcat(this.netname, " needs weapons ", ftos(needweapons) , "\n"));
+ LOG_DEBUG(strcat(this.netname, " needs armor ", ftos(needarmor) , "\n"));
// See what is around
head = findchainfloat(bot_pickup, true);
if ( ((head.health || head.armorvalue) && needarmor) || (head.weapons && needweapons ) )
if (vlen(head.origin - org) < sradius)
{
- t = head.bot_pickupevalfunc(self, head);
+ t = head.bot_pickupevalfunc(this, head);
if (t > 0)
- navigation_routerating(head, t * ratingscale, 500);
+ navigation_routerating(this, head, t * ratingscale, 500);
}
head = head.chain;
}
}
-void havocbot_role_ons_setrole(entity bot, int role)
+void havocbot_role_ons_setrole(entity this, int role)
{
- LOG_DEBUG(strcat(bot.netname," switched to "));
+ LOG_DEBUG(strcat(this.netname," switched to "));
switch(role)
{
case HAVOCBOT_ONS_ROLE_DEFENSE:
LOG_DEBUG("defense");
- bot.havocbot_role = havocbot_role_ons_defense;
- bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE;
- bot.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ons_defense;
+ this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_DEFENSE;
+ this.havocbot_role_timeout = 0;
break;
case HAVOCBOT_ONS_ROLE_ASSISTANT:
LOG_DEBUG("assistant");
- bot.havocbot_role = havocbot_role_ons_assistant;
- bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT;
- bot.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ons_assistant;
+ this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_ASSISTANT;
+ this.havocbot_role_timeout = 0;
break;
case HAVOCBOT_ONS_ROLE_OFFENSE:
LOG_DEBUG("offense");
- bot.havocbot_role = havocbot_role_ons_offense;
- bot.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE;
- bot.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ons_offense;
+ this.havocbot_role_flags = HAVOCBOT_ONS_ROLE_OFFENSE;
+ this.havocbot_role_timeout = 0;
break;
}
LOG_DEBUG("\n");
}
-void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ons_controlpoints_attack(entity this, float ratingscale)
+{
entity cp, cp1, cp2, best, wp;
float radius, bestvalue;
int c;
continue;
// Ignore owned controlpoints
- if(!(cp2.isgenneighbor[self.team] || cp2.iscpneighbor[self.team]))
+ if(!(cp2.isgenneighbor[this.team] || cp2.iscpneighbor[this.team]))
continue;
// Count team mates interested in this control point
// (easier and cleaner than keeping counters per cp and teams)
FOREACH_CLIENT(IS_PLAYER(it), {
- if(SAME_TEAM(it, self))
+ if(SAME_TEAM(it, this))
if(it.havocbot_role_flags & HAVOCBOT_ONS_ROLE_OFFENSE)
if(it.havocbot_ons_target == cp2)
++c;
{
bestvalue = cp1.wpcost;
cp = cp1;
- self.havocbot_ons_target = cp1;
+ this.havocbot_ons_target = cp1;
}
}
if (!cp)
return;
- LOG_DEBUG(strcat(self.netname, " chose cp ranked ", ftos(bestvalue), "\n"));
+ LOG_DEBUG(strcat(this.netname, " chose cp ranked ", ftos(bestvalue), "\n"));
if(cp.goalentity)
{
if(best)
{
- navigation_routerating(best, ratingscale, 10000);
+ navigation_routerating(this, best, ratingscale, 10000);
best.cnt += 1;
- self.havocbot_attack_time = 0;
- if(checkpvs(self.view_ofs,cp))
- if(checkpvs(self.view_ofs,best))
- self.havocbot_attack_time = time + 2;
+ this.havocbot_attack_time = 0;
+ if(checkpvs(this.view_ofs,cp))
+ if(checkpvs(this.view_ofs,best))
+ this.havocbot_attack_time = time + 2;
}
else
{
- navigation_routerating(cp, ratingscale, 10000);
+ navigation_routerating(this, cp, ratingscale, 10000);
}
- LOG_DEBUG(strcat(self.netname, " found an attackable controlpoint at ", vtos(cp.origin) ,"\n"));
+ LOG_DEBUG(strcat(this.netname, " found an attackable controlpoint at ", vtos(cp.origin) ,"\n"));
}
else
{
// Should be touched
- LOG_DEBUG(strcat(self.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n"));
+ LOG_DEBUG(strcat(this.netname, " found a touchable controlpoint at ", vtos(cp.origin) ,"\n"));
found = false;
// Look for auto generated waypoint
{
if(wp.classname=="waypoint")
{
- navigation_routerating(wp, ratingscale, 10000);
+ navigation_routerating(this, wp, ratingscale, 10000);
found = true;
}
}
// Nothing found, rate the controlpoint itself
if (!found)
- navigation_routerating(cp, ratingscale, 10000);
+ navigation_routerating(this, cp, ratingscale, 10000);
}
}
-bool havocbot_goalrating_ons_generator_attack(float ratingscale)
-{SELFPARAM();
+bool havocbot_goalrating_ons_generator_attack(entity this, float ratingscale)
+{
entity g, wp, bestwp;
bool found;
int best;
for(g = ons_worldgeneratorlist; g; g = g.ons_worldgeneratornext)
{
- if(SAME_TEAM(g, self) || g.isshielded)
+ if(SAME_TEAM(g, this) || g.isshielded)
continue;
// Should be attacked
if(bestwp)
{
LOG_DEBUG("waypoints found around generator\n");
- navigation_routerating(bestwp, ratingscale, 10000);
+ navigation_routerating(this, bestwp, ratingscale, 10000);
bestwp.cnt += 1;
- self.havocbot_attack_time = 0;
- if(checkpvs(self.view_ofs,g))
- if(checkpvs(self.view_ofs,bestwp))
- self.havocbot_attack_time = time + 5;
+ this.havocbot_attack_time = 0;
+ if(checkpvs(this.view_ofs,g))
+ if(checkpvs(this.view_ofs,bestwp))
+ this.havocbot_attack_time = time + 5;
return true;
}
{
LOG_DEBUG("generator found without waypoints around\n");
// if there aren't waypoints near the generator go straight to it
- navigation_routerating(g, ratingscale, 10000);
- self.havocbot_attack_time = 0;
+ navigation_routerating(this, g, ratingscale, 10000);
+ this.havocbot_attack_time = 0;
return true;
}
}
return false;
}
-void havocbot_role_ons_offense()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ons_offense(entity this)
+{
+ if(IS_DEAD(this))
{
- self.havocbot_attack_time = 0;
- havocbot_ons_reset_role(self);
+ this.havocbot_attack_time = 0;
+ havocbot_ons_reset_role(this);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 120;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 120;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ons_reset_role(self);
+ havocbot_ons_reset_role(this);
return;
}
- if(self.havocbot_attack_time>time)
+ if(this.havocbot_attack_time>time)
return;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- navigation_goalrating_start();
- havocbot_goalrating_enemyplayers(20000, self.origin, 650);
- if(!havocbot_goalrating_ons_generator_attack(20000))
- havocbot_goalrating_ons_controlpoints_attack(20000);
- havocbot_goalrating_ons_offenseitems(10000, self.origin, 10000);
- navigation_goalrating_end();
+ navigation_goalrating_start(this);
+ havocbot_goalrating_enemyplayers(this, 20000, this.origin, 650);
+ if(!havocbot_goalrating_ons_generator_attack(this, 20000))
+ havocbot_goalrating_ons_controlpoints_attack(this, 20000);
+ havocbot_goalrating_ons_offenseitems(this, 10000, this.origin, 10000);
+ navigation_goalrating_end(this);
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
}
}
-void havocbot_role_ons_assistant()
-{SELFPARAM();
- havocbot_ons_reset_role(self);
+void havocbot_role_ons_assistant(entity this)
+{
+ havocbot_ons_reset_role(this);
}
-void havocbot_role_ons_defense()
-{SELFPARAM();
- havocbot_ons_reset_role(self);
+void havocbot_role_ons_defense(entity this)
+{
+ havocbot_ons_reset_role(this);
}
-void havocbot_ons_reset_role(entity bot)
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_ons_reset_role(entity this)
+{
+ if(IS_DEAD(this))
return;
- bot.havocbot_ons_target = world;
+ this.havocbot_ons_target = world;
// TODO: Defend control points or generator if necessary
- havocbot_role_ons_setrole(bot, HAVOCBOT_ONS_ROLE_OFFENSE);
+ havocbot_role_ons_setrole(this, HAVOCBOT_ONS_ROLE_OFFENSE);
}
FOREACH_CLIENT(IS_PLAYER(it), {
it.ons_roundlost = false;
it.ons_deathloc = '0 0 0';
- WITH(entity, self, it, PutClientInServer());
+ WITHSELF(it, PutClientInServer());
});
return false;
}
}
MUTATOR_HOOKFUNCTION(ons, PlayerDies)
-{SELFPARAM();
+{
frag_target.ons_deathloc = frag_target.origin;
entity l;
for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
return false;
}
-void ons_MonsterSpawn_Delayed()
-{SELFPARAM();
+void ons_MonsterSpawn_Delayed(entity this)
+{
entity e, own = self.owner;
if(!own) { remove(self); return; }
return false;
}
-void ons_TurretSpawn_Delayed()
-{SELFPARAM();
+void ons_TurretSpawn_Delayed(entity this)
+{
entity e, own = self.owner;
if(!own) { remove(self); return; }
MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
{
+ SELFPARAM();
if(wp_sendflags & 16)
{
if(self.owner.classname == "onslaught_controlpoint")
MUTATOR_HOOKFUNCTION(ons, TurretThink)
{
+ SELFPARAM();
// ONS uses somewhat backwards linking.
if(self.target)
{
ScoreRules_basics_end();
}
-void ons_DelayedInit() // Do this check with a delay so we can wait for teams to be set up
+void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
{
ons_ScoreRules();
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+++ /dev/null
-/** If you register a new item, make sure to add it to this list */
-#include "item/ammo.qc"
-#include "item/armor.qc"
-#include "item/health.qc"
-#include "item/jetpack.qc"
-#include "item/pickup.qc"
-#include "item/powerup.qc"
#define ITEMS_ALL_C
#include "all.qh"
-#include "all.inc"
+#include "item/_mod.inc"
void Dump_Items()
{
#ifndef ITEMS_ALL_H
#define ITEMS_ALL_H
-#include "../command/all.qh"
+#include <common/command/all.qh>
#include "item.qh"
REGISTRY(Items, BITS(5))
#define Items_from(i) _Items_from(i, NULL)
REGISTER_REGISTRY(Items)
-/** If you register a new item, make sure to add it to all.inc */
#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
REGISTRY_SORT(Items)
#include "all.qh"
#include "item/pickup.qh"
-entityclass(Inventory);
-/** Stores counts of items, the id being the index */
-class(Inventory) .int inv_items[Items_MAX];
+CLASS(Inventory, Object)
+ /** Stores counts of items, the id being the index */
+ ATTRIBARRAY(Inventory, inv_items, int, Items_MAX)
+ /** Previous state */
+ ATTRIB(Inventory, inventory, Inventory, NULL)
+ENDCLASS(Inventory)
-/** Player inventory; Inventories also have one inventory for storing the previous state */
+/** Player inventory */
.Inventory inventory;
REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
#ifdef SVQC
void Inventory_Write(Inventory data)
{
+ if (!data) {
+ WriteInt24_t(MSG_ENTITY, 0);
+ return;
+ }
+ TC(Inventory, data);
int bits = 0;
FOREACH(Items, true, {
.int fld = inv_items[it.m_id];
#endif
#ifdef SVQC
-bool Inventory_Send(entity this, entity to, int sf)
+bool Inventory_Send(Inventory this, Client to, int sf)
{
+ TC(Inventory, this);
WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY);
- entity e = self.owner;
+ entity e = this.owner;
if (IS_SPEC(e)) e = e.enemy;
+ TC(Player, e);
Inventory data = e.inventory;
Inventory_Write(data);
return true;
void Inventory_new(entity e)
{
- Inventory inv = new_pure(Inventory), bak = new_pure(Inventory);
+ Inventory inv = NEW(Inventory), bak = NEW(Inventory);
inv.inventory = bak;
inv.drawonlytoclient = e;
Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
#define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
-/** If you register a new item, make sure to add it to all.inc */
CLASS(GameItem, Object)
ATTRIB(GameItem, m_id, int, 0)
ATTRIB(GameItem, m_name, string, string_null)
ATTRIB(GameItem, m_color, vector, '1 1 1')
ATTRIB(GameItem, m_waypoint, string, string_null)
ATTRIB(GameItem, m_waypointblink, int, 1)
- METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns)) {
+ METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns))
+ {
+ TC(GameItem, this);
returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
}
- METHOD(GameItem, show, void(GameItem this)) { LOG_INFO("A game item\n"); }
+ METHOD(GameItem, show, void(GameItem this))
+ {
+ TC(GameItem, this);
+ LOG_INFO("A game item\n");
+ }
void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
ENDCLASS(GameItem)
--- /dev/null
+// generated file; do not modify
+#include "ammo.qc"
+#include "armor.qc"
+#include "health.qc"
+#include "jetpack.qc"
+#include "pickup.qc"
+#include "powerup.qc"
#ifndef PICKUP_H
#define PICKUP_H
-#include "../inventory.qh"
-#include "../item.qh"
+#include <common/items/inventory.qh>
+#include <common/items/item.qh>
CLASS(Pickup, GameItem)
#ifndef MENUQC
ATTRIB(Pickup, m_model, Model, NULL)
ATTRIB(Pickup, m_sound, Sound, SND_ITEMPICKUP)
#endif
ATTRIB(Pickup, m_name, string, string_null)
- METHOD(Pickup, show, void(Pickup this)) { LOG_INFOF("%s: %s\n", etos(this), this.m_name); }
+ METHOD(Pickup, show, void(Pickup this))
+ {
+ TC(Pickup, this);
+ LOG_INFOF("%s: %s\n", etos(this), this.m_name);
+ }
#ifdef SVQC
ATTRIB(Pickup, m_mins, vector, '-16 -16 0')
ATTRIB(Pickup, m_maxs, vector, '16 16 32')
float Item_GiveTo(entity item, entity player);
METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player))
{
+ TC(Pickup, this);
bool b = Item_GiveTo(item, player);
if (b) {
LOG_TRACEF("entity %i picked up %s\n", player, this.m_name);
ATTRIB(Gametype, m_mutators, string, string_null)
ATTRIB(Gametype, m_parse_mapinfo, bool(string k, string v), func_null)
- METHOD(Gametype, describe, string(entity this)) { return this.gametype_description; }
+ METHOD(Gametype, describe, string(Gametype this))
+ {
+ TC(Gametype, this);
+ return this.gametype_description;
+ }
- METHOD(Gametype, display, void(entity this, void(string name, string icon) returns)) {
+ METHOD(Gametype, display, void(Gametype this, void(string name, string icon) returns))
+ {
+ TC(Gametype, this);
returns(this.message, strcat("gametype_", this.mdl));
}
--- /dev/null
+// generated file; do not modify
+#include "cl_minigames.qc"
+#include "cl_minigames_hud.qc"
+#include "minigames.qc"
+#include "sv_minigames.qc"
void name##_hud_board(vector, vector); \
void name##_hud_status(vector, vector); \
int name##_client_event(entity, string, ...); \
- REGISTER_INIT_POST(MINIGAME_##name) { \
+ REGISTER_INIT(MINIGAME_##name) { \
this.netname = strzone(strtolower(#name)); \
this.message = nicename; \
this.minigame_hud_board = name##_hud_board; \
#include "cl_minigames_hud.qh"
+
+#include <common/ent_cs.qh>
+
#include "minigames.qh"
+.vector colormod;
+
+#include <client/hud/hud_config.qh>
+#include <client/mapvoting.qh>
+
// whether the mouse is over the given panel
bool HUD_mouse_over(entity somepanel)
{
{SELFPARAM();
if ( menuitem )
{
- WITH(entity, self, menuitem, menuitem.use());
+ WITHSELF(menuitem, menuitem.use());
}
}
--- /dev/null
+// generated file; do not modify
+#include "bd.qc"
+#include "c4.qc"
+#include "nmm.qc"
+#include "pong.qc"
+#include "pp.qc"
+#include "ps.qc"
+#include "snake.qc"
+#include "ttt.qc"
#pragma once
#if defined(SVQC)
-#include "../sv_minigames.qh"
+#include <common/minigames/sv_minigames.qh>
#elif defined(CSQC)
-#include "../cl_minigames.qh"
+#include <common/minigames/cl_minigames.qh>
#endif
/**
void snake_move_head(entity minigame, entity head);
void snake_head_think()
{
+ SELFPARAM();
entity minigame = self.owner;
if(minigame.minigame_flags & SNAKE_TURN_MOVE)
if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
{
- WITH(entity, self, player, PutObserverInServer());
+ WITHSELF(player, PutObserverInServer());
}
if ( autocvar_sv_minigames_observer == 2 )
player.team_forced = -1;
#define REGISTER_MINIGAME(name,nicename) \
REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \
int name##_server_event(entity, string, ...); \
- REGISTER_INIT_POST(MINIGAME_##name) { \
+ REGISTER_INIT(MINIGAME_##name) { \
this.netname = strzone(strtolower(#name)); \
this.message = nicename; \
this.minigame_event = name##_server_event; \
--- /dev/null
+// generated file; do not modify
CONSTRUCT(Model);
this.model_str = path;
}
- METHOD(Model, model_precache, void(entity this)) {
+ METHOD(Model, model_precache, void(Model this))
+ {
+ TC(Model, this);
string s = this.model_str();
if (s != "" && s != "null" && !fexists(s)) {
LOG_WARNINGF("Missing model: \"%s\"\n", s);
return;
}
- LOG_TRACEF("precache_model(\"%s\")\n", s);
+ LOG_DEBUGF("precache_model(\"%s\")\n", s);
precache_model(s);
}
ENDCLASS(Model)
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "spawn.qc"
+#include "sv_monsters.qc"
+++ /dev/null
-#ifndef MENUQC
-#include "../animdecide.qh"
-vector animfixfps(entity e, vector a, vector b);
-#endif
-
-#include "monster/mage.qc"
-#include "monster/shambler.qc"
-#include "monster/spider.qc"
-#include "monster/wyvern.qc"
-#include "monster/zombie.qc"
#include "all.qh"
#define IMPLEMENTATION
-#include "all.inc"
+#include "monster/_mod.inc"
#undef IMPLEMENTATION
#ifdef SVQC
REGISTRY_CHECK(Monsters)
const int MON_FIRST = 1;
#define MON_LAST (Monsters_COUNT - 1)
-/** If you register a new monster, make sure to add it to all.inc */
#define REGISTER_MONSTER(id, inst) REGISTER(Monsters, MON, id, monsterid, inst)
REGISTER_MONSTER(Null, NEW(Monster));
-#include "all.inc"
+#include "monster/_mod.inc"
#endif
#include <lib/warpzone/server.qh>
#endif
+#ifndef MENUQC
+#include "../animdecide.qh"
+#include "../anim.qh"
+vector animfixfps(entity e, vector a, vector b);
+#endif
+
// special spawn flags
const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
const int MONSTER_TYPE_FLY = 32;
.vector anim_walk;
.vector anim_spawn;
-/** If you register a new monster, make sure to add it to all.inc */
CLASS(Monster, Object)
ATTRIB(Monster, monsterid, int, 0)
/** attributes */
ATTRIB(Monster, maxs, vector, '0 0 0')
/** (SERVER) setup monster data */
- METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { return false; }
+ METHOD(Monster, mr_setup, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
/** (SERVER) logic to run every frame */
- METHOD(Monster, mr_think, bool(Monster this, entity actor)) { return false; }
+ METHOD(Monster, mr_think, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
/** (SERVER) called when monster dies */
- METHOD(Monster, mr_death, bool(Monster this, entity actor)) { return false; }
+ METHOD(Monster, mr_death, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
/** (BOTH) precaches models/sounds used by this monster */
- METHOD(Monster, mr_precache, bool(Monster this)) { return false; }
+ METHOD(Monster, mr_precache, bool(Monster this)) { TC(Monster, this); return false; }
/** (SERVER) called when monster is damaged */
- METHOD(Monster, mr_pain, bool(Monster this, entity actor)) { return false; }
+ METHOD(Monster, mr_pain, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
/** (BOTH?) sets animations for monster */
- METHOD(Monster, mr_anim, bool(Monster this, entity actor)) { return false; }
+ METHOD(Monster, mr_anim, bool(Monster this, entity actor)) { TC(Monster, this); return false; }
ENDCLASS(Monster)
--- /dev/null
+// generated file; do not modify
+#include "mage.qc"
+#include "shambler.qc"
+#include "spider.qc"
+#include "wyvern.qc"
+#include "zombie.qc"
SOUND(MageSpike_FIRE, W_Sound("electro_fire"));
void M_Mage_Attack_Spike(entity this, vector dir);
void M_Mage_Attack_Push(entity this);
-METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weaponentity, int fire))
+{
+ TC(MageSpike, thiswep);
if (fire & 1)
if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range;
actor.enemy = Monster_FindTarget(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(MageSpike_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0);
if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
M_Mage_Attack_Spike(actor, w_shotdir);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
.bool OffhandMageTeleport_key_pressed;
METHOD(OffhandMageTeleport, offhand_think, void(OffhandMageTeleport this, entity player, bool key_pressed))
{
+ TC(OffhandMageTeleport, this);
if (key_pressed && !player.OffhandMageTeleport_key_pressed)
M_Mage_Attack_Teleport(player, player.enemy);
player.OffhandMageTeleport_key_pressed = key_pressed;
void M_Mage_Attack_Spike_Touch()
{
+ SELFPARAM();
PROJECTILE_TOUCH;
M_Mage_Attack_Spike_Explode(self);
Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
Send_Effect(EFFECT_SPAWN_NEUTRAL, newpos, '0 0 0', 1);
-
+
setorigin(this, newpos);
vector a = vectoangles(targ.origin - this.origin);
#ifdef SVQC
METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
{
+ TC(Mage, thismon);
bool need_help = false;
FOREACH_ENTITY_FLOAT(iscreature, true,
return true;
}
-METHOD(Mage, mr_pain, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_pain, bool(Mage this, entity actor))
{
+ TC(Mage, this);
return true;
}
-METHOD(Mage, mr_death, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_death, bool(Mage this, entity actor))
{
+ TC(Mage, this);
setanim(actor, actor.anim_die1, false, true, true);
return true;
}
#endif
#ifndef MENUQC
-METHOD(Mage, mr_anim, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_anim, bool(Mage this, entity actor))
{
+ TC(Mage, this);
vector none = '0 0 0';
actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
actor.anim_walk = animfixfps(actor, '1 1 1', none);
#ifdef SVQC
.float speed;
spawnfunc(item_health_large);
-METHOD(Mage, mr_setup, bool(Mage thismon, entity actor))
+METHOD(Mage, mr_setup, bool(Mage this, entity actor))
{
+ TC(Mage, this);
if(!actor.health) actor.health = (autocvar_g_monster_mage_health);
if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
return true;
}
-METHOD(Mage, mr_precache, bool(Mage thismon))
+METHOD(Mage, mr_precache, bool(Mage this))
{
+ TC(Mage, this);
return true;
}
#endif
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
}
void M_Shambler_Attack_Lightning_Touch()
#endif // SVQC
#ifdef SVQC
-METHOD(Shambler, mr_think, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_think, bool(Shambler this, entity actor))
{
+ TC(Shambler, this);
return true;
}
-METHOD(Shambler, mr_pain, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_pain, bool(Shambler this, entity actor))
{
+ TC(Shambler, this);
actor.pain_finished = time + 0.5;
setanim(actor, actor.anim_pain1, true, true, false);
return true;
}
-METHOD(Shambler, mr_death, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_death, bool(Shambler this, entity actor))
{
+ TC(Shambler, this);
setanim(actor, actor.anim_die1, false, true, true);
return true;
}
#endif
#ifndef MENUQC
-METHOD(Shambler, mr_anim, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_anim, bool(Shambler this, entity actor))
{
+ TC(Shambler, this);
vector none = '0 0 0';
actor.anim_die1 = animfixfps(actor, '8 1 0.5', none); // 2 seconds
actor.anim_walk = animfixfps(actor, '1 1 1', none);
#ifdef SVQC
spawnfunc(item_health_mega);
.float animstate_endtime;
-METHOD(Shambler, mr_setup, bool(Shambler thismon, entity actor))
+METHOD(Shambler, mr_setup, bool(Shambler this, entity actor))
{
+ TC(Shambler, this);
if(!actor.health) actor.health = (autocvar_g_monster_shambler_health);
if(!actor.attack_range) actor.attack_range = 150;
if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
return true;
}
-METHOD(Shambler, mr_precache, bool(Shambler thismon))
+METHOD(Shambler, mr_precache, bool(Shambler this))
{
+ TC(Shambler, this);
return true;
}
#endif
MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
{
- if (time >= self.spider_slowness)
+ SELFPARAM();
+ if (time >= this.spider_slowness)
return false;
- PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
- PHYS_MAXAIRSPEED(self) *= 0.5;
- PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
- PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
+ PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
+ PHYS_MAXAIRSPEED(this) *= 0.5;
+ PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
+ PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
return false;
}
MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
{
+ SELFPARAM();
if(time < self.spider_slowness)
{
monster_speed_run *= 0.5;
MUTATOR_HOOKFUNCTION(spiderweb, PlayerSpawn)
{
+ SELFPARAM();
self.spider_slowness = 0;
return false;
}
MUTATOR_HOOKFUNCTION(spiderweb, MonsterSpawn)
{
+ SELFPARAM();
self.spider_slowness = 0;
return false;
}
SOUND(SpiderAttack_FIRE, W_Sound("electro_fire"));
-METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(SpiderAttack, wr_think, void(SpiderAttack thiswep, entity actor, .entity weaponentity, int fire))
+{
+ SELFPARAM();
+ TC(SpiderAttack, thiswep);
bool isPlayer = IS_PLAYER(actor);
if (fire & 1)
if ((!isPlayer && time >= actor.spider_web_delay) || weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_monster_spider_attack_web_delay)) {
actor.anim_finished = time + 1;
}
if (isPlayer) actor.enemy = Monster_FindTarget(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(SpiderAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_SpiderAttack_FIRE, CH_WEAPON_B, 0);
if (!isPlayer) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin);
M_Spider_Attack_Web(actor);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
#endif // SVQC
#ifdef SVQC
-METHOD(Spider, mr_think, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_think, bool(Spider this, entity actor))
{
+ TC(Spider, this);
return true;
}
-METHOD(Spider, mr_pain, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_pain, bool(Spider this, entity actor))
{
+ TC(Spider, this);
return true;
}
-METHOD(Spider, mr_death, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_death, bool(Spider this, entity actor))
{
+ TC(Spider, this);
setanim(actor, actor.anim_melee, false, true, true);
actor.angles_x = 180;
return true;
}
#endif
#ifndef MENUQC
-METHOD(Spider, mr_anim, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_anim, bool(Spider this, entity actor))
{
+ TC(Spider, this);
vector none = '0 0 0';
actor.anim_walk = animfixfps(actor, '1 1 1', none);
actor.anim_idle = animfixfps(actor, '0 1 1', none);
#endif
#ifdef SVQC
spawnfunc(item_health_medium);
-METHOD(Spider, mr_setup, bool(Spider thismon, entity actor))
+METHOD(Spider, mr_setup, bool(Spider this, entity actor))
{
+ TC(Spider, this);
if(!actor.health) actor.health = (autocvar_g_monster_spider_health);
if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
return true;
}
-METHOD(Spider, mr_precache, bool(Spider thismon))
+METHOD(Spider, mr_precache, bool(Spider this))
{
+ TC(Spider, this);
return true;
}
#endif
void M_Wyvern_Attack_Fireball_Touch();
SOUND(WyvernAttack_FIRE, W_Sound("electro_fire"));
-METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire)) {
+METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity weaponentity, int fire))
+{
+ TC(WyvernAttack, thiswep);
if (fire & 1)
if (time > actor.attack_finished_single[0] || weapon_prepareattack(thiswep, actor, weaponentity, false, 1.2)) {
- if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND(WyvernAttack_FIRE), CH_WEAPON_B, 0);
+ if (IS_PLAYER(actor)) W_SetupShot_Dir(actor, v_forward, false, 0, SND_WyvernAttack_FIRE, CH_WEAPON_B, 0);
if (IS_MONSTER(actor)) {
actor.attack_finished_single[0] = time + 1.2;
actor.anim_finished = time + 1.2;
}
}
-METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack thiswep)) {
+METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this)) {
+ TC(WyvernAttack, this);
return true;
}
#endif // SVQC
#ifdef SVQC
-METHOD(Wyvern, mr_think, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_think, bool(Wyvern this, entity actor))
{
+ TC(Wyvern, this);
return true;
}
-METHOD(Wyvern, mr_pain, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_pain, bool(Wyvern this, entity actor))
{
+ TC(Wyvern, this);
actor.pain_finished = time + 0.5;
setanim(actor, actor.anim_pain1, true, true, false);
return true;
}
-METHOD(Wyvern, mr_death, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_death, bool(Wyvern this, entity actor))
{
+ TC(Wyvern, this);
setanim(actor, actor.anim_die1, false, true, true);
actor.velocity_x = -200 + 400 * random();
actor.velocity_y = -200 + 400 * random();
}
#endif
#ifndef MENUQC
-METHOD(Wyvern, mr_anim, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_anim, bool(Wyvern this, entity actor))
{
+ TC(Wyvern, this);
vector none = '0 0 0';
actor.anim_die1 = animfixfps(actor, '4 1 0.5', none); // 2 seconds
actor.anim_walk = animfixfps(actor, '1 1 1', none);
#endif
#ifdef SVQC
spawnfunc(item_cells);
-METHOD(Wyvern, mr_setup, bool(Wyvern thismon, entity actor))
+METHOD(Wyvern, mr_setup, bool(Wyvern this, entity actor))
{
+ TC(Wyvern, this);
if(!actor.health) actor.health = (autocvar_g_monster_wyvern_health);
if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
return true;
}
-METHOD(Wyvern, mr_precache, bool(Wyvern thismon))
+METHOD(Wyvern, mr_precache, bool(Wyvern this))
{
+ TC(Wyvern, this);
return true;
}
#endif
#endif // SVQC
#ifdef SVQC
-METHOD(Zombie, mr_think, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_think, bool(Zombie this, entity actor))
{
+ TC(Zombie, this);
if(time >= actor.spawn_time)
actor.damageforcescale = autocvar_g_monster_zombie_damageforcescale;
return true;
}
-METHOD(Zombie, mr_pain, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_pain, bool(Zombie this, entity actor))
{
+ TC(Zombie, this);
actor.pain_finished = time + 0.34;
setanim(actor, ((random() > 0.5) ? actor.anim_pain1 : actor.anim_pain2), true, true, false);
return true;
}
-METHOD(Zombie, mr_death, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_death, bool(Zombie this, entity actor))
{
+ TC(Zombie, this);
actor.armorvalue = autocvar_g_monsters_armor_blockpercent;
setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
}
#endif
#ifndef MENUQC
-METHOD(Zombie, mr_anim, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_anim, bool(Zombie this, entity actor))
{
+ TC(Zombie, this);
vector none = '0 0 0';
actor.anim_die1 = animfixfps(actor, '9 1 0.5', none); // 2 seconds
actor.anim_die2 = animfixfps(actor, '12 1 0.5', none); // 2 seconds
}
#endif
#ifdef SVQC
-METHOD(Zombie, mr_setup, bool(Zombie thismon, entity actor))
+METHOD(Zombie, mr_setup, bool(Zombie this, entity actor))
{
+ TC(Zombie, this);
if(!actor.health) actor.health = (autocvar_g_monster_zombie_health);
if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
return true;
}
-METHOD(Zombie, mr_precache, bool(Zombie thismon))
+METHOD(Zombie, mr_precache, bool(Zombie this))
{
+ TC(Zombie, this);
return true;
}
#endif
#include <server/defs.qh>
#endif
entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
-{SELFPARAM();
+{
float i;
entity e = spawn();
if(e && e.monster_loot)
{
e.noalign = true;
- WITH(entity, self, e, e.monster_loot(e));
+ WITHSELF(e, e.monster_loot(e));
e.gravity = 1;
e.movetype = MOVETYPE_TOSS;
e.reset = SUB_Remove;
void Monster_Delay_Action_self()
{
+ SELFPARAM();
Monster_Delay_Action(self);
}
void Monster_Remove(entity this)
{
+ if(IS_CLIENT(this))
+ return; // don't remove it?
+
.entity weaponentity = weaponentities[0];
if(!this) { return; }
// TODO: fix this?
activator = attacker;
other = this.enemy;
- WITH(entity, self, this, SUB_UseTargets());
+ WITHSELF(this, SUB_UseTargets());
this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
#define _MUTATOR_HANDLE_NOP(type, id)
#define _MUTATOR_HANDLE_PARAMS(type, id) , type in_##id
#define _MUTATOR_HANDLE_PREPARE(type, id) id = in_##id;
-#define _MUTATOR_HANDLE_PUSHTMP(type, id) type tmp_##id = id;
+#define _MUTATOR_HANDLE_PUSHTMP(type, id) TC(type, id); type tmp_##id = id;
#define _MUTATOR_HANDLE_PUSHOUT(type, id) type out_##id = id;
#define _MUTATOR_HANDLE_POPTMP(type, id) id = tmp_##id;
#define _MUTATOR_HANDLE_POPOUT(type, id) id = out_##id;
MUTATOR_ROLLING_BACK
};
-typedef bool(int) mutatorfunc_t;
+USING(mutatorfunc_t, bool(int));
CLASS(Mutator, Object)
ATTRIB(Mutator, m_id, int, 0)
--- /dev/null
+// generated file; do not modify
+#include "itemstime.qc"
--- /dev/null
+// generated file; do not modify
+#include "bloodloss.qc"
--- /dev/null
+// generated file; do not modify
+#include "breakablehook.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "buffs.qc"
REGISTRY_CHECK(Buffs)
#define REGISTER_BUFF(id) \
- REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff)); \
- REGISTER_INIT_POST(BUFF_##id) { \
- this.netname = this.m_name; \
- this.m_itemid = BIT(this.m_id - 1); \
- this.m_sprite = strzone(strcat("buff-", this.m_name)); \
- } \
- REGISTER_INIT(BUFF_##id)
+ REGISTER(Buffs, BUFF_##id, m_id, NEW(Buff))
#include <common/items/item/pickup.qh>
CLASS(Buff, Pickup)
#endif
ENDCLASS(Buff)
+STATIC_INIT(REGISTER_BUFFS) {
+ FOREACH(Buffs, true, {
+ it.netname = it.m_name; \
+ it.m_itemid = BIT(it.m_id - 1); \
+ it.m_sprite = strzone(strcat("buff-", it.m_name)); \
+ });
+}
+
#ifdef SVQC
// .int buffs = _STAT(BUFFS);
void buff_Init(entity ent);
#include <common/gamemodes/all.qh>
.float buff_time = _STAT(BUFF_TIME);
-void buffs_DelayedInit();
+void buffs_DelayedInit(entity this);
REGISTER_MUTATOR(buffs, cvar("g_buffs"))
{
return false;
}
-MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { return buffs_RemovePlayer(self); }
-MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { return buffs_RemovePlayer(self); }
+MUTATOR_HOOKFUNCTION(buffs, MakePlayerObserver) { SELFPARAM(); return buffs_RemovePlayer(self); }
+MUTATOR_HOOKFUNCTION(buffs, ClientDisconnect) { SELFPARAM(); return buffs_RemovePlayer(self); }
MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint)
{SELFPARAM();
{
entity oldother = other;
other = self;
- WITH(entity, self, it, it.touch());
+ WITHSELF(it, it.touch());
other = oldother;
}
return false;
}
-void buffs_DelayedInit()
+void buffs_DelayedInit(entity this)
{
if(autocvar_g_buffs_spawn_count > 0)
if(find(world, classname, "item_buff") == world)
--- /dev/null
+// generated file; do not modify
+#include "bugrigs.qc"
#endif
MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics)
{
+ SELFPARAM();
if(!PHYS_BUGRIGS(self) || !IS_PLAYER(self)) { return false; }
#ifdef SVQC
MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
{
+#ifdef SVQC
+ SELFPARAM();
+#endif
if(!PHYS_BUGRIGS(self)) { return false; }
#ifdef SVQC
self.bugrigs_prevangles = self.angles;
MUTATOR_HOOKFUNCTION(bugrigs, ClientConnect)
{
+ SELFPARAM();
stuffcmd(self, "cl_cmd settemp chase_active 1\n");
return false;
}
--- /dev/null
+// generated file; do not modify
+#include "campcheck.qc"
--- /dev/null
+// generated file; do not modify
+#include "cloaked.qc"
--- /dev/null
+// generated file; do not modify
+#include "damagetext.qc"
#define MUTATOR_DAMAGETEXT_H
#ifdef MENUQC
-#include <menu/xonotic/tab.qc>
+#include <menu/xonotic/tab.qh>
#endif
#endif
// no translatable cvar description please
AUTOCVAR_SAVE(cl_damagetext, bool, false, "Draw damage dealt where you hit the enemy");
AUTOCVAR_SAVE(cl_damagetext_format, string, "-{total}", "How to format the damage text. {health}, {armor}, {total}");
+STATIC_INIT(DamageText_LegacyFormat) {
+ if (strstrofs(autocvar_cl_damagetext_format, "{", 0) < 0) autocvar_cl_damagetext_format = "-{total}";
+}
AUTOCVAR_SAVE(cl_damagetext_color, vector, '1 1 0', "Damage text color");
AUTOCVAR_SAVE(cl_damagetext_color_per_weapon, bool, false, "Damage text uses weapon color");
AUTOCVAR_SAVE(cl_damagetext_size, float, 8, "Damage text font size");
--- /dev/null
+// generated file; do not modify
+#include "dodging.qc"
MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
{
+ SELFPARAM();
// print("dodging_PlayerPhysics\n");
PM_dodging_GetPressedKeys(self);
PM_dodging(self);
MUTATOR_HOOKFUNCTION(dodging, GetPressedKeys)
{
+ SELFPARAM();
PM_dodging_checkpressedkeys(self);
return false;
}
--- /dev/null
+// generated file; do not modify
+#include "doublejump.qc"
MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
{
+ SELFPARAM();
if (PHYS_DOUBLEJUMP(self))
{
tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
--- /dev/null
+// generated file; do not modify
+#include "hook.qc"
MUTATOR_HOOKFUNCTION(hook, FilterItem)
{
+ SELFPARAM();
return self.weapon == WEP_HOOK.m_id;
}
--- /dev/null
+// generated file; do not modify
+#include "instagib.qc"
+#include "items.qc"
if (self.items & ITEM_Invisibility.m_itemid)
{
- play_countdown(self.strength_finished, SND(POWEROFF));
+ play_countdown(self.strength_finished, SND_POWEROFF);
if (time > self.strength_finished)
{
self.alpha = default_player_alpha;
if (self.items & ITEM_Speed.m_itemid)
{
- play_countdown(self.invincible_finished, SND(POWEROFF));
+ play_countdown(self.invincible_finished, SND_POWEROFF);
if (time > self.invincible_finished)
{
self.items &= ~ITEM_Speed.m_itemid;
{
if(frag_deathtype & HITTYPE_SECONDARY)
{
- if(!autocvar_g_instagib_blaster_keepdamage)
+ if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
frag_damage = frag_mirrordamage = 0;
if(frag_target != frag_attacker)
e.cnt = self.cnt;
e.team = self.team;
e.spawnfunc_checked = true;
- WITH(entity, self, e, spawnfunc_item_minst_cells(e));
+ WITHSELF(e, spawnfunc_item_minst_cells(e));
return true;
}
+#pragma once
+
#include <common/items/all.qh>
#include <common/items/item/ammo.qh>
#include <common/items/item/powerup.qh>
--- /dev/null
+// generated file; do not modify
+#include "invincibleproj.qc"
}
MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
-{SELFPARAM();
+{
Item_ItemsTime_ResetTimes();
// ALL the times need to be reset before .reset()ing each item
// since Item_Reset schedules respawn of superweapons and powerups
FOREACH(Items, Item_ItemsTime_Allow(it) && ItemsTime_time[it.m_id] != -1, LAMBDA(
id = it.m_id;
icon = it.m_icon;
-
- :iteration
+
+LABEL(iteration)
float item_time = ItemsTime_time[id];
if (item_time < -1)
{
--- /dev/null
+// generated file; do not modify
+#include "melee_only.qc"
--- /dev/null
+// generated file; do not modify
+#include "midair.qc"
.float midair_shieldtime;
MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
-{SELFPARAM();
+{
if(IS_PLAYER(frag_attacker))
if(IS_PLAYER(frag_target))
if(time < frag_target.midair_shieldtime)
--- /dev/null
+// generated file; do not modify
+#include "multijump.qc"
MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
{
+ SELFPARAM();
#ifdef CSQC
- self.multijump_count = PHYS_MULTIJUMP_COUNT(self);
+ this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
#endif
if(!PHYS_MULTIJUMP) { return; }
- if(IS_ONGROUND(self))
- self.multijump_count = 0;
+ if(IS_ONGROUND(this))
+ this.multijump_count = 0;
return false;
}
MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
{
- return PM_multijump_checkjump(self);
+ SELFPARAM();
+ return PM_multijump_checkjump(this);
}
#ifdef SVQC
--- /dev/null
+// generated file; do not modify
+#include "nades.qc"
+#include "net.qc"
}
MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
{
+ SELFPARAM();
if (self.cnt == PROJECTILE_NAPALM_FOUNTAIN)
{
self.modelindex = 0;
}
MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
{
+ SELFPARAM();
if (self.cnt == PROJECTILE_NAPALM_FOUNTAIN)
{
loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM);
proj = new(grenade);
proj.owner = self.owner;
proj.realowner = self.realowner;
- proj.team = self.team;
+ proj.team = self.owner.team;
proj.bot_dodge = true;
proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
proj.movetype = MOVETYPE_BOUNCE;
{
if ( autocvar_g_nades_ice_explode )
{
- entity expef = EFFECT_NADE_EXPLODE(self.team);
+ entity expef = EFFECT_NADE_EXPLODE(self.realowner.team);
Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
setorigin(healer, self.origin);
healer.healer_lifetime = autocvar_g_nades_heal_time; // save the cvar
healer.ltime = time + healer.healer_lifetime;
- healer.team = self.team;
+ healer.team = self.realowner.team;
healer.bot_dodge = false;
healer.solid = SOLID_TRIGGER;
healer.touch = nade_heal_touch;
case NADE_TYPE_MONSTER:
case NADE_TYPE_SPAWN:
nade_blast = false;
- switch(self.team)
+ switch(self.realowner.team)
{
case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
default:
case NADE_TYPE_NORMAL:
- expef = EFFECT_NADE_EXPLODE(self.team);
+ expef = EFFECT_NADE_EXPLODE(self.realowner.team);
break;
}
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
this.takedamage = DAMAGE_NO;
- WITH(entity, self, this, nade_boom());
+ WITHSELF(this, nade_boom());
return;
}
this.health -= damage;
if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
- {
- this.team = attacker.team;
this.realowner = attacker;
- }
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
else
nade_burn_spawn(this);
}
makevectors(e.v_angle);
- W_SetupShot(e, false, false, "", CH_WEAPON_A, 0);
+ W_SetupShot(e, false, false, SND_Null, CH_WEAPON_A, 0);
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
{
+ SELFPARAM();
nades_RemoveBonus(self);
}
//setattachment(n, player, "bip01 l hand");
n.exteriormodeltoclient = player;
n.customizeentityforclient = nade_customize;
- n.team = player.team;
- n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], n.team).eent_eff_name);
+ n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
n.colormod = Nades_from(n.nade_type).m_color;
n.realowner = nowner;
n.colormap = player.colormap;
MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
{
+ SELFPARAM();
if (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
nades_CheckThrow();
return true;
--- /dev/null
+// generated file; do not modify
+#include "new_toys.qc"
--- /dev/null
+// generated file; do not modify
+#include "nix.qc"
REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"))
{
+ SELFPARAM();
MUTATOR_ONADD
{
g_nix_with_blaster = autocvar_g_nix_with_blaster;
MUTATOR_ONREMOVE
{
// as the PlayerSpawn hook will no longer run, NIX is turned off by this!
- FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
it.ammo_cells = start_ammo_cells;
it.ammo_plasma = start_ammo_plasma;
it.ammo_shells = start_ammo_shells;
it.weapons = start_weapons;
if(!client_hasweapon(it, PS(it).m_weapon, true, false))
PS(it).m_switchweapon = w_getbestweapon(self);
- ));
+ });
}
return 0;
--- /dev/null
+// generated file; do not modify
+#include "hmg.qc"
+#include "overkill.qc"
+#include "rpc.qc"
REGISTER_MUTATOR(hmg_nadesupport, true);
MUTATOR_HOOKFUNCTION(hmg_nadesupport, Nade_Damage)
{
+ SELFPARAM();
if (MUTATOR_ARGV(0, entity) != WEP_HMG) return;
return = true;
MUTATOR_ARGV(0, float) /* damage */ = self.max_health * 0.1;
void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
+ SELFPARAM();
if (!PHYS_INPUT_BUTTON_ATCK(actor))
{
w_ready(thiswep, actor, weaponentity, fire);
W_DecreaseAmmo(WEP_HMG, self, WEP_CVAR(hmg, ammo));
- W_SetupShot (actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(hmg, damage));
+ W_SetupShot (actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(hmg, damage));
if(!autocvar_g_norecoil)
{
}
float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
- fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
METHOD(HeavyMachineGun, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
else
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
}
METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
if(autocvar_g_balance_hmg_reload_ammo)
METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
if(autocvar_g_balance_hmg_reload_ammo)
METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, WEP_CVAR(hmg, ammo), SND_RELOAD);
}
METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep))
METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
e.pickup_anyway = true;
e.spawnfunc_checked = true;
spawnfunc_item_armor_small(e);
- e.movetype = MOVETYPE_TOSS;
- e.gravity = 1;
- e.reset = SUB_Remove;
- setorigin(e, frag_target.origin + '0 0 32');
- e.velocity = '0 0 200' + normalize(targ.origin - frag_target.origin) * 500;
- SUB_SetFade(e, time + 5, 1);
+ if (!wasfreed(e)) { // might have been blocked by a mutator
+ e.movetype = MOVETYPE_TOSS;
+ e.gravity = 1;
+ e.reset = SUB_Remove;
+ setorigin(e, frag_target.origin + '0 0 32');
+ e.velocity = '0 0 200' + normalize(targ.origin - frag_target.origin) * 500;
+ SUB_SetFade(e, time + 5, 1);
+ }
frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id;
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
}
void W_RocketPropelledChainsaw_Think()
entity flash = spawn ();
W_DecreaseAmmo(thiswep, self, WEP_CVAR(rpc, ammo));
- W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(rpc, damage));
+ W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
PROJECTILE_MAKETRIGGER(missile);
METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep))
{
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
+ SELFPARAM();
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
}
METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
return ammo_amount;
METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, WEP_CVAR(rpc, ammo), SND_RELOAD);
}
METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
--- /dev/null
+// generated file; do not modify
+#include "physical_items.qc"
setorigin(wep, wep.origin + '0 0 1');
entity oldself;
oldself = self;
- WITH(entity, self, wep, builtin_droptofloor());
+ WITHSELF(wep, builtin_droptofloor());
}
wep.spawn_origin = wep.origin;
--- /dev/null
+// generated file; do not modify
+#include "pinata.qc"
--- /dev/null
+// generated file; do not modify
+#include "random_gravity.qc"
--- /dev/null
+// generated file; do not modify
+#include "rocketflying.qc"
--- /dev/null
+// generated file; do not modify
+#include "rocketminsta.qc"
--- /dev/null
+// generated file; do not modify
+#include "running_guns.qc"
--- /dev/null
+// generated file; do not modify
+#include "sandbox.qc"
--- /dev/null
+// generated file; do not modify
+#include "spawn_near_teammate.qc"
--- /dev/null
+// generated file; do not modify
+#include "superspec.qc"
bool superspec_Spectate(entity _player)
{SELFPARAM();
if(Spectate(_player) == 1)
- self.classname = STR_SPECTATOR;
+ TRANSMUTE(Spectator, self);
return true;
}
MUTATOR_HOOKFUNCTION(superspec, PlayerDies)
{
+ SELFPARAM();
FOREACH_CLIENT(IS_SPEC(it), LAMBDA(
setself(it);
if(self.autospec_flags & ASF_FOLLOWKILLER && IS_PLAYER(frag_attacker) && self.enemy == frag_target)
--- /dev/null
+// generated file; do not modify
+#include "touchexplode.qc"
--- /dev/null
+// generated file; do not modify
+#include "vampire.qc"
--- /dev/null
+// generated file; do not modify
+#include "vampirehook.qc"
--- /dev/null
+// generated file; do not modify
+#include "waypointsprites.qc"
--- /dev/null
+// generated file; do not modify
+#include "weaponarena_random.qc"
REGISTER_NET_TEMP(TE_CSQC_SVNOTICE)
#ifdef SVQC
-void sv_notice_join_think()
+void sv_notice_join_think(entity this)
{
- SELFPARAM();
int argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
if (argc <= 0) return;
for (int i = 0; i < argc; ++i)
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
MSG net_type, Notification net_name,
...count)
{
- if (!IS_REAL_CLIENT(client)) return;
+ if (broadcast != NOTIF_ALL && broadcast != NOTIF_ALL_EXCEPT && !IS_REAL_CLIENT(client)) return;
entity notif = net_name;
string parms = sprintf("%s, '%s', %s, %s",
Get_Notif_BroadcastName(broadcast),
CASE(CPID, LAST)
ENUMCLASS_END(CPID)
-typedef entity Notification;
+USING(Notification, entity);
// used for notification system multi-team identifiers
#define APP_TEAM_NUM(num, prefix) ((num == NUM_TEAM_1) ? prefix##_RED : ((num == NUM_TEAM_2) ? prefix##_BLUE : ((num == NUM_TEAM_3) ? prefix##_YELLOW : prefix##_PINK)))
--- /dev/null
+// generated file; do not modify
+#include "movelib.qc"
+#include "player.qc"
**/
#endif
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{SELFPARAM();
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
+{
vector a, b, c, d, e, r, push_angle, ahead, side;
push_angle.y = 0;
- r = (self.absmax + self.absmin) * 0.5 + (v_up * spring_up);
+ r = (this.absmax + this.absmin) * 0.5 + (v_up * spring_up);
e = v_up * spring_length;
// Put springs slightly inside bbox
- ahead = v_forward * (self.maxs.x * 0.8);
- side = v_right * (self.maxs.y * 0.8);
+ ahead = v_forward * (this.maxs.x * 0.8);
+ side = v_right * (this.maxs.y * 0.8);
a = r + ahead + side;
b = r + ahead - side;
c = r - ahead + side;
d = r - ahead - side;
- traceline(a, a - e,MOVE_NORMAL,self);
+ traceline(a, a - e,MOVE_NORMAL,this);
a.z = (1 - trace_fraction);
r = trace_endpos;
- traceline(b, b - e,MOVE_NORMAL,self);
+ traceline(b, b - e,MOVE_NORMAL,this);
b.z = (1 - trace_fraction);
r += trace_endpos;
- traceline(c, c - e,MOVE_NORMAL,self);
+ traceline(c, c - e,MOVE_NORMAL,this);
c.z = (1 - trace_fraction);
r += trace_endpos;
- traceline(d, d - e,MOVE_NORMAL,self);
+ traceline(d, d - e,MOVE_NORMAL,this);
d.z = (1 - trace_fraction);
r += trace_endpos;
a.x = r.z;
- r = self.origin;
+ r = this.origin;
r.z = r.z;
push_angle.x = (a.z - c.z) * _max;
push_angle.z = (b.z - a.z) * _max;
push_angle.z += (d.z - c.z) * _max;
- //self.angles_x += push_angle_x * 0.95;
- //self.angles_z += push_angle_z * 0.95;
+ //this.angles_x += push_angle_x * 0.95;
+ //this.angles_z += push_angle_z * 0.95;
- self.angles_x = ((1-blendrate) * self.angles.x) + (push_angle.x * blendrate);
- self.angles_z = ((1-blendrate) * self.angles.z) + (push_angle.z * blendrate);
+ this.angles_x = ((1-blendrate) * this.angles.x) + (push_angle.x * blendrate);
+ this.angles_z = ((1-blendrate) * this.angles.z) + (push_angle.z * blendrate);
- //a = self.origin;
- setorigin(self,r);
+ //a = this.origin;
+ setorigin(this,r);
}
**/
#endif
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max);
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max);
#endif
--- /dev/null
+// generated file; do not modify
+#include "follow.qc"
+#include "movetypes.qc"
+#include "push.qc"
+#include "step.qc"
+#include "toss.qc"
+#include "walk.qc"
{
other = oth;
- WITH(entity, self, this, this.move_touch());
+ WITHSELF(this, this.move_touch());
other = oldother;
}
{
other = this;
- WITH(entity, self, oth, oth.move_touch());
+ WITHSELF(oth, oth.move_touch());
other = oldother;
}
trace_plane_dist = 0;
trace_ent = this;
- WITH(entity, self, it, it.move_touch());
+ WITHSELF(it, it.move_touch());
}
});
this.move_nextthink = 0;
this.move_time = time;
other = world;
- WITH(entity, self, this, this.move_think());
+ WITHSELF(this, this.move_think());
}
}
PM_ClientMovement_Unstick(this);
// set crouched
- if (PHYS_INPUT_BUTTON_CROUCH(this))
+ bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+ if(this.hook && !wasfreed(this.hook))
+ do_crouch = false;
+ if(hud != HUD_NORMAL)
+ do_crouch = false;
+ if(STAT(FROZEN, this))
+ do_crouch = false;
+ if((activeweapon == WEP_SHOCKWAVE || activeweapon == WEP_SHOTGUN) && viewmodel.animstate_startframe == viewmodel.anim_fire2_x && time < viewmodel.weapon_nextthink)
+ do_crouch = false;
+
+ if (do_crouch)
{
// wants to crouch, this always works
if (!IS_DUCKED(this)) SET_DUCKED(this);
if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && this.movement.y == 0 && this.movement.x != 0)
PM_AirAccelerate(this, wishdir, wishspeed2);
- else
- PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd, PHYS_AIRSPEEDLIMIT_NONQW(this));
+ else {
+ float sidefric = maxairspd ? (PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd) : 0;
+ PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), sidefric, PHYS_AIRSPEEDLIMIT_NONQW(this));
+ }
if (PHYS_AIRCONTROL(this))
CPM_PM_Aircontrol(this, wishdir, wishspeed2);
#ifdef SVQC
- WarpZone_PlayerPhysics_FixVAngle();
+ WarpZone_PlayerPhysics_FixVAngle(this);
#endif
float maxspeed_mod = 1;
maxspeed_mod *= PHYS_HIGHSPEED(this);
Physics_UpdateStats(this, maxspeed_mod);
if (this.PlayerPhysplug)
- if (this.PlayerPhysplug())
+ if (this.PlayerPhysplug(this))
return;
#elif defined(CSQC)
if(autocvar_slowmo != STAT(MOVEVARS_TIMESCALE))
{
if (playerdemo_read(this))
return;
- WITH(entity, self, this, bot_think());
+ bot_think(this);
}
#endif
else
PM_air(this, buttons_prev, maxspeed_mod);
-:end
+LABEL(end)
if (IS_ONGROUND(this))
this.lastground = time;
.vector v_angle_old;
.string lastclassname;
-.float() PlayerPhysplug;
+.float(entity) PlayerPhysplug;
float AdjustAirAccelQW(float accelqw, float factor);
bool IsFlying(entity a);
#define ITEMS_STAT(s) ((s).items)
+.float teleport_time;
+
#ifdef CSQC
string autocvar_cl_jumpspeedcap_min;
.vector movement;
.vector v_angle;
+ .entity hook;
+
// TODO
#define IS_CLIENT(s) ((s).isplayermodel)
#define IS_PLAYER(s) ((s).isplayermodel)
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
return string_null;
#endif
}
- METHOD(Sound, sound_precache, void(entity this))
+ METHOD(Sound, sound_precache, void(Sound this))
{
+ TC(Sound, this);
string s = Sound_fixpath(this);
if (!s) return;
- LOG_TRACEF("precache_sound(\"%s\")\n", s);
+ LOG_DEBUGF("precache_sound(\"%s\")\n", s);
precache_sound(s);
}
ENDCLASS(Sound)
void PlayerState_detach(entity this)
{
- if (!PS(this)) return; // initial connect
- FOREACH_CLIENT(PS(it) == PS(this), { PS(it) = NULL; });
- remove(PS(this));
- this._ps = NULL;
-
- Inventory_delete(self);
+ PlayerState ps = PS(this);
+ if (!ps) return; // initial connect
+ PS(this) = NULL;
+ if (ps.m_client != this) return; // don't own state, spectator
+ FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
+ remove(ps);
+
+ Inventory_delete(this);
}
-void GetCvars(int);
+void GetCvars(entity this, int);
void DecodeLevelParms(entity this);
void PlayerScore_Attach(entity this);
void ClientData_Attach(entity this);
{
this._cs = NEW(ClientState, this);
- GetCvars(0); // get other cvars from player
+ GetCvars(this, 0); // get other cvars from player
// TODO: xonstat elo.txt support, until then just 404s
if (false && IS_REAL_CLIENT(this)) { PlayerStats_PlayerBasic_CheckUpdate(this); }
bot_clientconnect(this);
}
-void bot_clientdisconnect();
+void bot_clientdisconnect(entity this);
void W_HitPlotClose(entity this);
-void anticheat_report();
+void anticheat_report(entity this);
void playerdemo_shutdown();
void entcs_detach(entity this);
void accuracy_free(entity this);
remove(CS(this));
this._cs = NULL;
- GetCvars(-1); // free cvars
+ GetCvars(this, -1); // free cvars
- bot_clientdisconnect();
+ bot_clientdisconnect(this);
W_HitPlotClose(this);
- anticheat_report();
+ anticheat_report(this);
playerdemo_shutdown();
entcs_detach(this);
accuracy_free(self);
ATTRIB(PlayerState, m_weapon, Weapon, Weapons_from(-1))
METHOD(PlayerState, ps_push, void(PlayerState this, entity cl))
{
+ TC(PlayerState, this);
STAT(ACTIVEWEAPON, cl) = this.m_weapon.m_id;
STAT(SWITCHINGWEAPON, cl) = this.m_switchingweapon.m_id;
STAT(SWITCHWEAPON, cl) = this.m_switchweapon.m_id;
ENDCLASS(PlayerState)
.PlayerState _ps;
-#if NDEBUG
- #define PS(this) (this._ps)
-#else
- PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
-#endif
+#define PS(this) ((this)._ps)
// TODO: renew on death
void PlayerState_attach(entity this);
#if NDEBUG
#define CS(this) (this._cs)
#else
- ClientState CS(entity this) { assert(IS_CLIENT(this)); assert(this._cs); return this._cs; }
+ ClientState CS(Client this) { TC(Client, this); assert(this._cs); return this._cs; }
#endif
void ClientState_attach(entity this);
#define STATS_H
#ifdef SVQC
-#include "../server/cl_client.qh"
+#include <server/cl_client.qh>
#endif
// Full list of all stat constants, included in a single location for easy reference
REGISTER_STAT(MOVEVARS_AIRCONTROL, float)
REGISTER_STAT(FRAGLIMIT, float, autocvar_fraglimit)
REGISTER_STAT(TIMELIMIT, float, autocvar_timelimit)
+REGISTER_STAT(WARMUP_TIMELIMIT, float, warmup_limit)
#ifdef SVQC
float autocvar_sv_wallfriction;
#endif
return false;
-:YEAH
+LABEL(YEAH)
switch(mode)
{
case ITEM_MODE_FUEL:
player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
}
-:skip
+LABEL(skip)
// always eat teamed entities
if(item.team)
return;
}
- :pickup
+LABEL(pickup)
other.last_pickup = time;
}
void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
-void Item_FindTeam()
-{SELFPARAM();
+void Item_FindTeam(entity this)
+{
entity e;
if(self.effects & EF_NODRAW)
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
- WITH(entity, self, this, RemoveItem());
+ WITHSELF(this, RemoveItem());
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
this.SendFlags |= ISF_SIZE;
// note droptofloor returns false if stuck/or would fall too far
if (!this.noalign)
- WITH(entity, self, this, droptofloor());
+ WITHSELF(this, droptofloor());
waypoint_spawnforitem(this);
}
void Item_Reset(entity this);
-void Item_FindTeam();
+void Item_FindTeam(entity this);
// Savage: used for item garbage-collection
bool ItemSend(entity this, entity to, int sf);
--- /dev/null
+// generated file; do not modify
+#include "include.qc"
+#include "platforms.qc"
+#include "subs.qc"
+#include "teleporters.qc"
+#include "triggers.qc"
--- /dev/null
+// generated file; do not modify
+#include "bobbing.qc"
+#include "breakable.qc"
+#include "button.qc"
+#include "conveyor.qc"
+#include "door.qc"
+#include "door_rotating.qc"
+#include "door_secret.qc"
+#include "fourier.qc"
+#include "include.qc"
+#include "ladder.qc"
+#include "pendulum.qc"
+#include "plat.qc"
+#include "pointparticles.qc"
+#include "rainsnow.qc"
+#include "rotating.qc"
+#include "stardust.qc"
+#include "train.qc"
+#include "vectormamamam.qc"
WaypointSprite_Ping(this.sprite);
WaypointSprite_UpdateHealth(this.sprite, this.health);
}
- WITH(entity, self, this, func_breakable_colormod());
+ WITHSELF(this, func_breakable_colormod());
if(this.health <= 0)
{
if (this.health <= 0)
{
this.enemy = damage_attacker;
- WITH(entity, self, this, button_fire());
+ WITHSELF(this, button_fire());
}
}
#elif defined(CSQC)
-void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
void conveyor_init()
{SELFPARAM();
if (self.owner)
{
- WITH(entity, self, self.owner, door_fire());
+ WITHSELF(self.owner, door_fire());
}
}
{
this.owner.health = this.owner.max_health;
this.owner.takedamage = DAMAGE_NO; // wil be reset upon return
- WITH(entity, self, this.owner, door_use());
+ WITHSELF(this.owner, door_use());
}
}
#ifdef SVQC
void door_link();
#endif
-void LinkDoors()
-{SELFPARAM();
+void LinkDoors(entity this)
+{
entity t;
vector cmins, cmaxs;
}
#endif
-void door_init_startopen()
-{SELFPARAM();
+void door_init_startopen(entity this)
+{
SUB_SETORIGIN(self, self.pos2);
self.pos2 = self.pos1;
self.pos1 = self.origin;
this.drawmask = MASK_NORMAL;
this.use = door_use;
- LinkDoors();
+ LinkDoors(this);
if(this.spawnflags & DOOR_START_OPEN)
- door_init_startopen();
+ door_init_startopen(this);
this.move_time = time;
this.move_origin = this.origin;
this.nextthink = 0;
}
-void door_rotating_init_startopen()
-{SELFPARAM();
+void door_rotating_init_startopen(entity this)
+{
self.angles = self.movedir;
self.pos2 = '0 0 0';
self.pos1 = self.movedir;
void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
- WITH(entity, self, this, fd_secret_use());
+ WITHSELF(this, fd_secret_use());
}
// Wait after first movement...
void func_ladder_link()
{
+ SELFPARAM();
self.SendEntity = func_ladder_send;
self.SendFlags = 0xFFFFFF;
//self.model = "null";
void func_ladder_init()
{
+ SELFPARAM();
self.touch = func_ladder_touch;
trigger_init(self);
#ifdef SVQC
void plat_link();
-void plat_delayedinit()
+void plat_delayedinit(entity this)
{
plat_link();
plat_spawn_inside_trigger(); // the "start moving" trigger
}
}
WriteShort(MSG_ENTITY, self.cnt);
+ WriteString(MSG_ENTITY, self.mdl);
if(fl & 0x20)
{
WriteShort(MSG_ENTITY, compressShortVector(self.velocity));
spawnfunc(func_pointparticles)
{
- if(this.model != "") _setmodel(this, this.model);
+ if(this.model != "") { precache_model(this.model); _setmodel(this, this.model); }
if(this.noise != "") precache_sound(this.noise);
+ if(this.mdl != "") this.cnt = 0; // use a good handler
if(!this.bgmscriptsustain) this.bgmscriptsustain = 1;
else if(this.bgmscriptsustain < 0) this.bgmscriptsustain = 0;
setorigin(this, this.origin + this.mins);
setsize(this, '0 0 0', this.maxs - this.mins);
}
- if(!this.cnt) this.cnt = _particleeffectnum(this.mdl);
+ //if(!this.cnt) this.cnt = _particleeffectnum(this.mdl);
Net_LinkEntity(this, (this.spawnflags & 4), 0, pointparticles_SendEntity);
{
traceline(p, p + normalize(self.movedir) * 4096, 0, world);
p = trace_endpos;
- __pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
+ int eff_num;
+ if(self.cnt)
+ eff_num = self.cnt;
+ else
+ eff_num = _particleeffectnum(self.mdl);
+ __pointparticles(eff_num, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
}
else
{
- __pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count);
+ int eff_num;
+ if(self.cnt)
+ eff_num = self.cnt;
+ else
+ eff_num = _particleeffectnum(self.mdl);
+ __pointparticles(eff_num, p, self.velocity + randomvec() * self.waterlevel, self.count);
}
if(self.noise != "")
{
if(this.bgmscript)
strunzone(this.bgmscript);
this.bgmscript = string_null;
+ if(this.mdl)
+ strunzone(this.mdl);
+ this.mdl = string_null;
}
NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
if(f & 2)
{
i = ReadCoord(); // density (<0: point, >0: volume)
- if(i && !self.impulse && self.cnt) // self.cnt check is so it only happens if the ent already existed
+ if(i && !self.impulse && (self.cnt || self.mdl)) // self.cnt check is so it only happens if the ent already existed
self.just_toggled = 1;
self.impulse = i;
}
}
self.cnt = ReadShort(); // effect number
+ self.mdl = strzone(ReadString()); // effect string
if(f & 0x20)
{
#endif
void train_wait()
{SELFPARAM();
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
self.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
void train_use()
{
+ SELFPARAM();
self.SUB_NEXTTHINK = self.SUB_LTIME + 1;
self.SUB_THINK = train_next;
self.use = func_null; // not again
}
-void func_train_find()
-{SELFPARAM();
+void func_train_find(entity this)
+{
entity targ;
targ = find(world, targetname, self.target);
self.target = targ.target;
self.owner.velocity = (self.owner.destvec + func_vectormamamam_origin(self.owner, 0.1) - self.owner.origin) * 10;
}
-void func_vectormamamam_findtarget()
-{SELFPARAM();
+void func_vectormamamam_findtarget(entity this)
+{
if(self.target != "")
self.wp00 = find(world, targetname, self.target);
--- /dev/null
+// generated file; do not modify
+#include "corner.qc"
+#include "follow.qc"
+#include "include.qc"
+#include "laser.qc"
+#include "teleport_dest.qc"
// the way this entity works makes it no use to CSQC, as it removes itself instantly
#ifdef SVQC
-void follow_init()
-{SELFPARAM();
+void follow_init(entity this)
+{
entity src, dst;
src = world;
dst = world;
}
}
-void misc_laser_init()
-{SELFPARAM();
+void misc_laser_init(entity this)
+{
if(self.target != "")
self.enemy = find(world, targetname, self.target);
}
self.count = 1;
activator = self.enemy.pusher;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
}
}
else
self.count = 0;
activator = self.enemy.pusher;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
}
}
}
void teleport_dest_link()
{SELFPARAM();
- //Net_LinkEntity(self, false, 0, teleport_dest_send);
- //self.SendFlags |= 1; // update
+ Net_LinkEntity(self, false, 0, teleport_dest_send);
+ self.SendFlags |= 1; // update
}
spawnfunc(info_teleport_destination)
void generic_plat_blocked()
-{SELFPARAM();
+{
#ifdef SVQC
+ SELFPARAM();
if(self.dmg && other.takedamage != DAMAGE_NO)
{
if(self.dmgtime2 < time)
void SUB_SetFade_Think ()
{SELFPARAM();
- if(self.alpha == 0)
- self.alpha = 1;
- self.SUB_THINK = SUB_SetFade_Think;
- self.SUB_NEXTTHINK = time;
- self.alpha -= frametime * self.fade_rate;
- if (self.alpha < 0.01)
- SUB_VanishOrRemove(self);
+ if(this.alpha == 0)
+ this.alpha = 1;
+ this.SUB_THINK = SUB_SetFade_Think;
+ this.SUB_NEXTTHINK = time;
+ this.alpha -= frametime * this.fade_rate;
+ if (this.alpha < 0.01)
+ SUB_VanishOrRemove(this);
else
- self.SUB_NEXTTHINK = time;
+ this.SUB_NEXTTHINK = time;
}
/*
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
{SELFPARAM();
- WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
}
/*
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
{SELFPARAM();
- WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
}
.vector move_origin;
void SUB_SETORIGIN(entity s, vector v)
- {SELFPARAM();
+ {
s.move_origin = v;
_Movetype_LinkEdict(s, true);
}
--- /dev/null
+// generated file; do not modify
+#include "changelevel.qc"
+#include "include.qc"
+#include "location.qc"
+#include "music.qc"
+#include "spawn.qc"
+#include "speaker.qc"
+#include "voicescript.qc"
#ifdef SVQC
+void target_push_init(entity this);
+
spawnfunc(target_location)
{
self.classname = "target_location";
// location name in netname
// eventually support: count, teamgame selectors, line of sight?
+
+ target_push_init(this);
}
spawnfunc(info_location)
{
- self.classname = "target_location";
- self.message = self.netname;
+ this.classname = "target_location";
+ this.message = this.netname;
+
+ target_push_init(this);
}
#endif
}
void target_music_kill()
{
- for(self = world; (self = find(self, classname, "target_music")); )
- {
- self.volume = 0;
- if(self.targetname == "")
- target_music_sendto(MSG_ALL, 1);
- else
- target_music_sendto(MSG_ALL, 0);
- }
+ FOREACH_ENTITY_CLASS("target_music", true, {
+ it.volume = 0;
+ if (it.targetname == "")
+ WITHSELF(it, target_music_sendto(MSG_ALL, 1));
+ else
+ WITHSELF(it, target_music_sendto(MSG_ALL, 0));
+ });
}
void target_music_use()
{
oldactivator = activator;
activator = act;
- WITH(entity, self, e, e.target_spawn_spawnfunc(e));
+ WITHSELF(e, e.target_spawn_spawnfunc(e));
activator = oldactivator;
// We called an external function, so we have to re-tokenize msg.
}
}
-void target_spawn_spawnfirst()
-{SELFPARAM();
+void target_spawn_spawnfirst(entity this)
+{
activator = self.target_spawn_activator;
if(self.spawnflags & 2)
target_spawn_use();
#endif
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
-{SELFPARAM();
+{
entity telefragger;
vector from;
makevectors (to_angles);
#ifdef SVQC
+ SELFPARAM();
if(player.teleportable == TELEPORT_NORMAL) // don't play sounds or show particles for anything that isn't a player, maybe change later to block only observers
{
if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
return e;
}
-void teleport_findtarget()
+void teleport_findtarget(entity this)
{
int n = 0;
entity e;
}
void WarpZone_PostTeleportPlayer_Callback(entity pl)
-{SELFPARAM();
+{
#ifdef SVQC
makevectors(pl.angles);
Reset_ArcBeam(pl, v_forward);
void Teleport_Touch ();
-void teleport_findtarget();
+void teleport_findtarget(entity this);
entity Teleport_Find(vector mi, vector ma);
--- /dev/null
+// generated file; do not modify
+#include "counter.qc"
+#include "delay.qc"
+#include "disablerelay.qc"
+#include "flipflop.qc"
+#include "gamestart.qc"
+#include "gravity.qc"
+#include "heal.qc"
+#include "hurt.qc"
+#include "impulse.qc"
+#include "include.qc"
+#include "jumppads.qc"
+#include "keylock.qc"
+#include "magicear.qc"
+#include "monoflop.qc"
+#include "multi.qc"
+#include "multivibrator.qc"
+#include "relay.qc"
+#include "relay_activators.qc"
+#include "relay_if.qc"
+#include "relay_teamcheck.qc"
+#include "secret.qc"
+#include "swamp.qc"
+#include "teleport.qc"
+#include "viewloc.qc"
#ifdef SVQC
-void gamestart_use()
-{SELFPARAM();
+void gamestart_use(entity this)
+{
activator = self;
SUB_UseTargets();
remove(self);
void self_spawnfunc_trigger_gamestart();
spawnfunc(trigger_gamestart)
{
- this.use = gamestart_use;
+ setuse(this, gamestart_use);
this.reset2 = self_spawnfunc_trigger_gamestart;
if(this.wait)
void trigger_impulse_link()
{
+ SELFPARAM();
trigger_link(self, trigger_impulse_send);
}
#elif defined(CSQC)
NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
{
- self.spawnflags = ReadInt24_t();
- self.radius = ReadCoord();
- self.strength = ReadCoord();
- self.falloff = ReadByte();
- self.active = ReadByte();
+ this.spawnflags = ReadInt24_t();
+ this.radius = ReadCoord();
+ this.strength = ReadCoord();
+ this.falloff = ReadByte();
+ this.active = ReadByte();
trigger_common_read(true);
return = true;
- self.classname = "trigger_impulse";
- self.solid = SOLID_TRIGGER;
- self.entremove = trigger_remove_generic;
- //self.draw = trigger_draw_generic;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
+ this.classname = "trigger_impulse";
+ this.solid = SOLID_TRIGGER;
+ this.entremove = trigger_remove_generic;
+ //this.draw = trigger_draw_generic;
+ this.drawmask = MASK_NORMAL;
+ this.move_time = time;
- if(self.radius) { self.move_touch = trigger_impulse_touch3; }
- else if(self.target) { self.move_touch = trigger_impulse_touch1; }
- else { self.move_touch = trigger_impulse_touch2; }
+ if(this.radius) { this.move_touch = trigger_impulse_touch3; }
+ else if(this.target) { this.move_touch = trigger_impulse_touch1; }
+ else { this.move_touch = trigger_impulse_touch2; }
}
#endif
if(this.enemy.target)
{
activator = other;
- WITH(entity, self, this.enemy, SUB_UseTargets());
+ WITHSELF(this.enemy, SUB_UseTargets());
}
if (other.flags & FL_PROJECTILE)
#ifdef SVQC
void trigger_push_link();
-void trigger_push_updatelink();
+void trigger_push_updatelink(entity this);
#endif
-void trigger_push_findtarget()
-{SELFPARAM();
+void trigger_push_findtarget(entity this)
+{
entity t;
vector org;
// first calculate a typical start point for the jump
- org = (self.absmin + self.absmax) * 0.5;
- org_z = self.absmax.z - STAT(PL_MIN, NULL).z;
+ org = (this.absmin + this.absmax) * 0.5;
+ org_z = this.absmax.z - STAT(PL_MIN, NULL).z;
- if (self.target)
+ if (this.target)
{
float n = 0;
- for(t = world; (t = find(t, targetname, self.target)); )
+ for(t = world; (t = find(t, targetname, this.target)); )
{
++n;
#ifdef SVQC
entity e = spawn();
setorigin(e, org);
setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
- e.velocity = trigger_push_calculatevelocity(org, t, self.height);
+ e.velocity = trigger_push_calculatevelocity(org, t, this.height);
tracetoss(e, e);
if(e.movetype == MOVETYPE_NONE)
- waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
remove(e);
#endif
}
else if(n == 1)
{
// exactly one dest - bots love that
- self.enemy = find(world, targetname, self.target);
+ this.enemy = find(world, targetname, this.target);
}
else
{
// have to use random selection every single time
- self.enemy = world;
+ this.enemy = world;
}
}
#ifdef SVQC
entity e = spawn();
setorigin(e, org);
setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
- e.velocity = self.movedir;
+ e.velocity = this.movedir;
tracetoss(e, e);
- waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
remove(e);
}
trigger_push_link();
- defer(self, 0.1, trigger_push_updatelink);
+ defer(this, 0.1, trigger_push_updatelink);
#endif
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
- WriteByte(MSG_ENTITY, self.team);
- WriteInt24_t(MSG_ENTITY, self.spawnflags);
- WriteByte(MSG_ENTITY, self.active);
- WriteCoord(MSG_ENTITY, self.height);
+ WriteByte(MSG_ENTITY, this.team);
+ WriteInt24_t(MSG_ENTITY, this.spawnflags);
+ WriteByte(MSG_ENTITY, this.active);
+ WriteCoord(MSG_ENTITY, this.height);
- trigger_common_write(self, true);
+ trigger_common_write(this, true);
return true;
}
-void trigger_push_updatelink()
-{SELFPARAM();
- self.SendFlags |= 1;
+void trigger_push_updatelink(entity this)
+{
+ this.SendFlags |= 1;
}
void trigger_push_link()
{
- trigger_link(self, trigger_push_send);
+ SELFPARAM();
+ trigger_link(this, trigger_push_send);
}
/*
*/
spawnfunc(trigger_push)
{
- SetMovedir(self);
+ SetMovedir(this);
- trigger_init(self);
+ trigger_init(this);
- self.active = ACTIVE_ACTIVE;
- self.use = trigger_push_use;
- self.touch = trigger_push_touch;
+ this.active = ACTIVE_ACTIVE;
+ this.use = trigger_push_use;
+ this.touch = trigger_push_touch;
// normal push setup
- if (!self.speed)
- self.speed = 1000;
- self.movedir = self.movedir * self.speed * 10;
+ if (!this.speed)
+ this.speed = 1000;
+ this.movedir = this.movedir * this.speed * 10;
- if (!self.noise)
- self.noise = "misc/jumppad.wav";
- precache_sound (self.noise);
+ if (!this.noise)
+ this.noise = "misc/jumppad.wav";
+ precache_sound (this.noise);
// this must be called to spawn the teleport waypoints for bots
- InitializeEntity(self, trigger_push_findtarget, INITPRIO_FINDTARGET);
+ InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
- WriteByte(MSG_ENTITY, self.cnt);
- WriteString(MSG_ENTITY, self.targetname);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteByte(MSG_ENTITY, this.cnt);
+ WriteString(MSG_ENTITY, this.targetname);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
- WriteAngle(MSG_ENTITY, self.angles_x);
- WriteAngle(MSG_ENTITY, self.angles_y);
- WriteAngle(MSG_ENTITY, self.angles_z);
+ WriteAngle(MSG_ENTITY, this.angles_x);
+ WriteAngle(MSG_ENTITY, this.angles_y);
+ WriteAngle(MSG_ENTITY, this.angles_z);
return true;
}
{
make_pure(this);
- self.classname = "jumppad";
- int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
- self.spawnflags = ReadInt24_t();
- self.active = ReadByte();
- self.height = ReadCoord();
+ this.classname = "jumppad";
+ int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
+ this.spawnflags = ReadInt24_t();
+ this.active = ReadByte();
+ this.height = ReadCoord();
trigger_common_read(true);
- self.entremove = trigger_remove_generic;
- self.solid = SOLID_TRIGGER;
- //self.draw = trigger_draw_generic;
- self.move_touch = trigger_push_touch;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
- defer(self, 0.25, trigger_push_findtarget);
+ this.entremove = trigger_remove_generic;
+ this.solid = SOLID_TRIGGER;
+ //this.draw = trigger_draw_generic;
+ this.move_touch = trigger_push_touch;
+ this.drawmask = MASK_NORMAL;
+ this.move_time = time;
+ defer(this, 0.25, trigger_push_findtarget);
return true;
}
NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
{
- self.classname = "push_target";
- self.cnt = ReadByte();
- self.targetname = strzone(ReadString());
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.classname = "push_target";
+ this.cnt = ReadByte();
+ this.targetname = strzone(ReadString());
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
- self.angles_x = ReadAngle();
- self.angles_y = ReadAngle();
- self.angles_z = ReadAngle();
+ this.angles_x = ReadAngle();
+ this.angles_y = ReadAngle();
+ this.angles_z = ReadAngle();
return = true;
- setorigin(self, self.origin);
+ setorigin(this, this.origin);
- self.drawmask = MASK_NORMAL;
- self.entremove = target_push_remove;
+ this.drawmask = MASK_NORMAL;
+ this.entremove = target_push_remove;
}
#endif
void trigger_push_touch();
.vector dest;
-void trigger_push_findtarget();
+void trigger_push_findtarget(entity this);
/*
* ENTITY PARAMETERS:
{
this.enemy = attacker;
this.goalentity = inflictor;
- WITH(entity, self, this, multi_trigger());
+ WITHSELF(this, multi_trigger());
}
}
{
self.reset = multi_reset;
if (self.sounds == 1)
- {
- precache_sound ("misc/secret.wav");
self.noise = "misc/secret.wav";
- }
else if (self.sounds == 2)
- {
self.noise = strzone(SND(TALK));
- }
else if (self.sounds == 3)
- {
- precache_sound ("misc/trigger1.wav");
self.noise = "misc/trigger1.wav";
- }
+
+ if(self.noise)
+ precache_sound(self.noise);
if (!self.wait)
self.wait = 0.2;
void secrets_setstatus()
{SELFPARAM();
- self.stat_secrets_total = secrets_total;
- self.stat_secrets_found = secrets_found;
+ this.stat_secrets_total = secrets_total;
+ this.stat_secrets_found = secrets_found;
}
/**
SUB_UseTargets();
if (!self.target) self.target = s;
- WITH(entity, self, e, SUB_UseTargets());
+ WITHSELF(e, SUB_UseTargets());
#endif
}
return true;
}
-void viewloc_init()
-{SELFPARAM();
+void viewloc_init(entity this)
+{
entity e;
for(e = world; (e = find(e, targetname, self.target)); )
if(e.classname == "target_viewlocation_start")
void DelayThink()
{SELFPARAM();
- activator = self.enemy;
+ activator = this.enemy;
SUB_UseTargets ();
- remove(self);
+ remove(this);
}
void FixSize(entity e)
void trigger_init(entity this)
{
string m = this.model;
- WITH(entity, self, this, WarpZoneLib_ExactTrigger_Init());
+ WITHSELF(this, WarpZoneLib_ExactTrigger_Init());
if(m != "")
{
precache_model(m);
void trigger_common_read(bool withtarget)
{SELFPARAM();
int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
+ this.warpzone_isboxy = (f & 1);
if(withtarget)
{
- if(self.target) { strunzone(self.target); }
- self.target = strzone(ReadString());
- if(self.target2) { strunzone(self.target2); }
- self.target2 = strzone(ReadString());
- if(self.target3) { strunzone(self.target3); }
- self.target3 = strzone(ReadString());
- if(self.target4) { strunzone(self.target4); }
- self.target4 = strzone(ReadString());
- if(self.targetname) { strunzone(self.targetname); }
- self.targetname = strzone(ReadString());
- if(self.killtarget) { strunzone(self.killtarget); }
- self.killtarget = strzone(ReadString());
+ if(this.target) { strunzone(this.target); }
+ this.target = strzone(ReadString());
+ if(this.target2) { strunzone(this.target2); }
+ this.target2 = strzone(ReadString());
+ if(this.target3) { strunzone(this.target3); }
+ this.target3 = strzone(ReadString());
+ if(this.target4) { strunzone(this.target4); }
+ this.target4 = strzone(ReadString());
+ if(this.targetname) { strunzone(this.targetname); }
+ this.targetname = strzone(ReadString());
+ if(this.killtarget) { strunzone(this.killtarget); }
+ this.killtarget = strzone(ReadString());
}
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- setorigin(self, self.origin);
-
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- setsize(self, self.mins, self.maxs);
-
- self.movedir_x = ReadCoord();
- self.movedir_y = ReadCoord();
- self.movedir_z = ReadCoord();
-
- self.angles_x = ReadCoord();
- self.angles_y = ReadCoord();
- self.angles_z = ReadCoord();
+ this.origin = '0 0 0';
+ setorigin(this, this.origin);
+
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ setsize(this, this.mins, this.maxs);
+
+ this.movedir_x = ReadCoord();
+ this.movedir_y = ReadCoord();
+ this.movedir_z = ReadCoord();
+
+ this.angles_x = ReadCoord();
+ this.angles_y = ReadCoord();
+ this.angles_z = ReadCoord();
}
void trigger_remove_generic(entity this)
//
// check for a delay
//
- if (self.delay)
+ if (this.delay)
{
// create a temp object to fire at a later time
t = new(DelayedUse);
- t.nextthink = time + self.delay;
+ t.nextthink = time + this.delay;
t.think = DelayThink;
t.enemy = activator;
- t.message = self.message;
- t.killtarget = self.killtarget;
- t.target = self.target;
- t.target2 = self.target2;
- t.target3 = self.target3;
- t.target4 = self.target4;
+ t.message = this.message;
+ t.killtarget = this.killtarget;
+ t.target = this.target;
+ t.target2 = this.target2;
+ t.target3 = this.target3;
+ t.target4 = this.target4;
return;
}
// print the message
//
#ifdef SVQC
- if(self)
- if(IS_PLAYER(activator) && self.message != "")
+ if(this)
+ if(IS_PLAYER(activator) && this.message != "")
if(IS_REAL_CLIENT(activator))
{
- centerprint(activator, self.message);
- if (self.noise == "")
+ centerprint(activator, this.message);
+ if (this.noise == "")
play2(activator, SND(TALK));
}
//
// kill the killtagets
//
- s = self.killtarget;
+ s = this.killtarget;
if (s != "")
{
for(t = world; (t = find(t, targetname, s)); )
{
// Flag to set func_clientwall state
// 1 == deactivate, 2 == activate, 0 == do nothing
- float aw_flag = self.antiwall_flag;
+ float aw_flag = this.antiwall_flag;
for(t = world; (t = find(t, targetname, s)); )
if(t.use)
{
if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
{
other = e;
- WITH(entity, self, this, touchfunc());
+ WITHSELF(this, touchfunc());
}
}
}
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "checkpoint.qc"
+#include "cl_turrets.qc"
+#include "config.qc"
+#include "sv_turrets.qc"
+#include "targettrigger.qc"
+#include "util.qc"
+++ /dev/null
-#include "turret/ewheel.qc"
-#include "turret/flac.qc"
-#include "turret/fusionreactor.qc"
-#include "turret/hellion.qc"
-#include "turret/hk.qc"
-#include "turret/machinegun.qc"
-#include "turret/mlrs.qc"
-#include "turret/phaser.qc"
-#include "turret/plasma.qc"
-#include "turret/plasma_dual.qc"
-#include "turret/tesla.qc"
-#include "turret/walker.qc"
#endif
#define IMPLEMENTATION
-#include "all.inc"
+#include "turret/_mod.inc"
#undef IMPLEMENTATION
#ifdef CSQC
#ifndef TURRETS_ALL_H
#define TURRETS_ALL_H
-#include "../command/all.qh"
+#include <common/command/all.qh>
#include "config.qh"
#include "turret.qh"
REGISTER_TURRET(Null, NEW(Turret));
-#include "all.inc"
+#include "turret/_mod.inc"
#endif
this.health -= damage;
//this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
}
-entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
+entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
{SELFPARAM();
+ TC(Sound, _snd);
entity proj;
- _sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
+ sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
proj = spawn ();
setorigin(proj, self.tur_shotorg);
setsize(proj, '-0.5 -0.5 -0.5' * _size, '0.5 0.5 0.5' * _size);
#ifndef SV_TURRETS_H
#define SV_TURRETS_H
-entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
+entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
void turret_projectile_explode();
float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
float turret_firecheck();
#ifndef TURRET_H
#define TURRET_H
-#include "../weapons/all.qh"
+#include <common/weapons/all.qh>
CLASS(Turret, Object)
ATTRIB(Turret, m_id, int, 0)
--- /dev/null
+// generated file; do not modify
+#include "ewheel.qc"
+#include "ewheel_weapon.qc"
+#include "flac.qc"
+#include "flac_weapon.qc"
+#include "fusionreactor.qc"
+#include "hellion.qc"
+#include "hellion_weapon.qc"
+#include "hk.qc"
+#include "hk_weapon.qc"
+#include "machinegun.qc"
+#include "machinegun_weapon.qc"
+#include "mlrs.qc"
+#include "mlrs_weapon.qc"
+#include "phaser.qc"
+#include "phaser_weapon.qc"
+#include "plasma.qc"
+#include "plasma_dual.qc"
+#include "plasma_weapon.qc"
+#include "tesla.qc"
+#include "tesla_weapon.qc"
+#include "walker.qc"
+#include "walker_weapon.qc"
//#define EWHEEL_FANCYPATH
-#include "ewheel_weapon.qc"
+#include "ewheel_weapon.qh"
CLASS(EWheel, Turret)
/* spawnflags */ ATTRIB(EWheel, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE | TUR_FLAG_ROAM);
#ifdef IMPLEMENTATION
-#include "ewheel_weapon.qc"
-
#ifdef SVQC
float autocvar_g_turrets_unit_ewheel_speed_fast;
-#ifndef TURRET_EWHEEL_WEAPON_H
-#define TURRET_EWHEEL_WEAPON_H
-
-CLASS(EWheelAttack, PortoLaunch)
-/* flags */ ATTRIB(EWheelAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(EWheelAttack, impulse, int, 5);
-/* refname */ ATTRIB(EWheelAttack, netname, string, "turret_ewheel");
-/* wepname */ ATTRIB(EWheelAttack, m_name, string, _("eWheel"));
-ENDCLASS(EWheelAttack)
-REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
-
-#endif
+#include "ewheel_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(EWheelAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_EWheelAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
turret_do_updates(actor);
- entity missile = turret_projectile(SND(LASERGUN_FIRE), 1, 0, DEATH_TURRET_EWHEEL.m_id, PROJECTILE_BLASTER, true, true);
+ entity missile = turret_projectile(SND_LASERGUN_FIRE, 1, 0, DEATH_TURRET_EWHEEL.m_id, PROJECTILE_BLASTER, true, true);
missile.missile_flags = MIF_SPLASH;
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
--- /dev/null
+#pragma once
+
+CLASS(EWheelAttack, PortoLaunch)
+/* flags */ ATTRIB(EWheelAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(EWheelAttack, impulse, int, 5);
+/* refname */ ATTRIB(EWheelAttack, netname, string, "turret_ewheel");
+/* wepname */ ATTRIB(EWheelAttack, m_name, string, _("eWheel"));
+ENDCLASS(EWheelAttack)
+REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
#ifndef TURRET_FLAC_H
#define TURRET_FLAC_H
-#include "flac_weapon.qc"
+#include "flac_weapon.qh"
CLASS(Flac, Turret)
/* spawnflags */ ATTRIB(Flac, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_MISSILE);
#ifdef IMPLEMENTATION
-#include "flac_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_flac) { if (!turret_initialize(TUR_FLAC)) remove(self); }
-#ifndef TURRET_FLAC_WEAPON_H
-#define TURRET_FLAC_WEAPON_H
-
-CLASS(FlacAttack, PortoLaunch)
-/* flags */ ATTRIB(FlacAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(FlacAttack, impulse, int, 5);
-/* refname */ ATTRIB(FlacAttack, netname, string, "turret_flac");
-/* wepname */ ATTRIB(FlacAttack, m_name, string, _("FLAC"));
-ENDCLASS(FlacAttack)
-REGISTER_WEAPON(FLAC, NEW(FlacAttack));
-
-#endif
+#include "flac_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(FlacAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_FlacAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
turret_tag_fire_update();
- entity proj = turret_projectile(SND(HAGAR_FIRE), 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true);
+ entity proj = turret_projectile(SND_HAGAR_FIRE, 5, 0, DEATH_TURRET_FLAC.m_id, PROJECTILE_HAGAR, true, true);
proj.missile_flags = MIF_SPLASH | MIF_PROXY;
proj.think = turret_flac_projectile_think_explode;
proj.nextthink = time + actor.tur_impacttime + (random() * 0.01 - random() * 0.01);
--- /dev/null
+#pragma once
+
+CLASS(FlacAttack, PortoLaunch)
+/* flags */ ATTRIB(FlacAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(FlacAttack, impulse, int, 5);
+/* refname */ ATTRIB(FlacAttack, netname, string, "turret_flac");
+/* wepname */ ATTRIB(FlacAttack, m_name, string, _("FLAC"));
+ENDCLASS(FlacAttack)
+REGISTER_WEAPON(FLAC, NEW(FlacAttack));
}
METHOD(FusionReactor, tr_think, void(FusionReactor thistur, entity it))
{
+ SELFPARAM();
self.tur_head.avelocity = '0 250 0' * (self.ammo / self.ammo_max);
}
METHOD(FusionReactor, tr_setup, void(FusionReactor this, entity it))
#ifndef TURRET_HELLION_H
#define TURRET_HELLION_H
-#include "hellion_weapon.qc"
+#include "hellion_weapon.qh"
CLASS(Hellion, Turret)
/* spawnflags */ ATTRIB(Hellion, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
#ifdef IMPLEMENTATION
-#include "hellion_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_hellion) { if (!turret_initialize(TUR_HELLION)) remove(self); }
METHOD(Hellion, tr_think, void(Hellion thistur, entity it))
{
+ SELFPARAM();
if (self.tur_head.frame != 0)
self.tur_head.frame += 1;
-#ifndef TURRET_HELLION_WEAPON_H
-#define TURRET_HELLION_WEAPON_H
-
-CLASS(HellionAttack, PortoLaunch)
-/* flags */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(HellionAttack, impulse, int, 9);
-/* refname */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
-/* wepname */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
-ENDCLASS(HellionAttack)
-REGISTER_WEAPON(HELLION, NEW(HellionAttack));
-
-#endif
+#include "hellion_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(HellionAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_HellionAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
actor.tur_shotorg = gettaginfo(actor.tur_head, gettagindex(actor.tur_head, "tag_fire2"));
}
- entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
+ entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HELLION.m_id, PROJECTILE_ROCKET, false, false);
te_explosion (missile.origin);
missile.think = turret_hellion_missile_think;
missile.nextthink = time;
--- /dev/null
+#pragma once
+
+CLASS(HellionAttack, PortoLaunch)
+/* flags */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(HellionAttack, impulse, int, 9);
+/* refname */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
+/* wepname */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
+ENDCLASS(HellionAttack)
+REGISTER_WEAPON(HELLION, NEW(HellionAttack));
//#define TURRET_DEBUG_HK
-#include "hk_weapon.qc"
+#include "hk_weapon.qh"
CLASS(HunterKiller, Turret)
/* spawnflags */ ATTRIB(HunterKiller, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER | TUR_FLAG_RECIEVETARGETS);
#ifdef IMPLEMENTATION
-#include "hk_weapon.qc"
-
#ifdef SVQC
#ifdef TURRET_DEBUG_HK
METHOD(HunterKiller, tr_think, void(HunterKiller thistur, entity it))
{
+ SELFPARAM();
if (self.tur_head.frame != 0)
self.tur_head.frame = self.tur_head.frame + 1;
-#ifndef TURRET_HK_WEAPON_H
-#define TURRET_HK_WEAPON_H
-
-CLASS(HunterKillerAttack, PortoLaunch)
-/* flags */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(HunterKillerAttack, impulse, int, 9);
-/* refname */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
-/* wepname */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
-ENDCLASS(HunterKillerAttack)
-REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
-
-#endif
+#include "hk_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(HunterKillerAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_HunterKillerAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
+ entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_HK.m_id, PROJECTILE_ROCKET, false, false);
te_explosion (missile.origin);
missile.think = turret_hk_missile_think;
--- /dev/null
+#pragma once
+
+CLASS(HunterKillerAttack, PortoLaunch)
+/* flags */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(HunterKillerAttack, impulse, int, 9);
+/* refname */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
+/* wepname */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
+ENDCLASS(HunterKillerAttack)
+REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
#ifndef TURRET_MACHINEGUN_H
#define TURRET_MACHINEGUN_H
-#include "machinegun_weapon.qc"
+#include "machinegun_weapon.qh"
CLASS(MachineGunTurret, Turret)
/* spawnflags */ ATTRIB(MachineGunTurret, spawnflags, int, TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "machinegun_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_machinegun) { if (!turret_initialize(TUR_MACHINEGUN)) remove(self); }
-#ifndef TURRET_MACHINEGUN_WEAPON_H
-#define TURRET_MACHINEGUN_WEAPON_H
-
-CLASS(MachineGunTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
-/* wepname */ ATTRIB(MachineGunTurretAttack, m_name, string, _("Machinegun"));
-ENDCLASS(MachineGunTurretAttack)
-REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
-
-#endif
+#include "machinegun_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(MachineGunTurretAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_MachineGunTurretAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
}
- fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
+ fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
W_MachineGun_MuzzleFlash();
setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
}
--- /dev/null
+#pragma once
+
+CLASS(MachineGunTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
+/* wepname */ ATTRIB(MachineGunTurretAttack, m_name, string, _("Machinegun"));
+ENDCLASS(MachineGunTurretAttack)
+REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
#ifndef TURRET_MLRS_H
#define TURRET_MLRS_H
-#include "mlrs_weapon.qc"
+#include "mlrs_weapon.qh"
CLASS(MLRSTurret, Turret)
/* spawnflags */ ATTRIB(MLRSTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "mlrs_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(self); }
METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur, entity it))
{
+ SELFPARAM();
// 0 = full, 6 = empty
self.tur_head.frame = bound(0, 6 - floor(0.1 + self.ammo / self.shot_dmg), 6);
if(self.tur_head.frame < 0)
-#ifndef TURRET_MLRS_WEAPON_H
-#define TURRET_MLRS_WEAPON_H
-
-CLASS(MLRSTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
-/* wepname */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
-ENDCLASS(MLRSTurretAttack)
-REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
-
-#endif
+#include "mlrs_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(MLRSTurretAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_MLRSTurretAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
}
turret_tag_fire_update();
- entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_MLRS.m_id, PROJECTILE_ROCKET, true, true);
+ entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_MLRS.m_id, PROJECTILE_ROCKET, true, true);
missile.nextthink = time + max(actor.tur_impacttime,(actor.shot_radius * 2) / actor.shot_speed);
missile.missile_flags = MIF_SPLASH;
te_explosion (missile.origin);
--- /dev/null
+#pragma once
+
+CLASS(MLRSTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
+/* wepname */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
+ENDCLASS(MLRSTurretAttack)
+REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
#ifndef TURRET_PHASER_H
#define TURRET_PHASER_H
-#include "phaser_weapon.qc"
+#include "phaser_weapon.qh"
CLASS(PhaserTurret, Turret)
/* spawnflags */ ATTRIB(PhaserTurret, spawnflags, int, TUR_FLAG_SNIPER | TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "phaser_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); }
+.int fireflag;
+
METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it))
{
+ SELFPARAM();
if (self.tur_head.frame != 0)
{
if (self.fireflag == 1)
-#ifndef TURRET_PHASER_WEAPON_H
-#define TURRET_PHASER_WEAPON_H
-
-CLASS(PhaserTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
-/* wepname */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
-ENDCLASS(PhaserTurretAttack)
-REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
-
-#endif
+#include "phaser_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(PhaserTurretAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_PhaserTurretAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
--- /dev/null
+#pragma once
+
+CLASS(PhaserTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
+/* wepname */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
+ENDCLASS(PhaserTurretAttack)
+REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
#ifndef TURRET_PLASMA_H
#define TURRET_PLASMA_H
-#include "plasma_weapon.qc"
+#include "plasma_weapon.qh"
CLASS(PlasmaTurret, Turret)
/* spawnflags */ ATTRIB(PlasmaTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "plasma_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_plasma) { if (!turret_initialize(TUR_PLASMA)) remove(self); }
}
METHOD(PlasmaTurret, tr_think, void(PlasmaTurret thistur, entity it))
{
+ SELFPARAM();
if (self.tur_head.frame != 0)
self.tur_head.frame = self.tur_head.frame + 1;
#ifndef TURRET_PLASMA_DUAL_H
#define TURRET_PLASMA_DUAL_H
+#include "plasma_weapon.qh"
+
CLASS(PlasmaDualAttack, PlasmaAttack)
/* refname */ ATTRIB(PlasmaDualAttack, netname, string, "turret_plasma_dual");
/* wepname */ ATTRIB(PlasmaDualAttack, m_name, string, _("Dual plasma"));
spawnfunc(turret_plasma_dual) { if (!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
-METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret this, entity it))
+METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it))
{
+ SELFPARAM();
if (g_instagib) {
FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
} else {
- SUPER(PlasmaTurret).tr_attack(this, it);
+ SUPER(PlasmaTurret).tr_attack(thistur, it);
}
self.tur_head.frame += 1;
}
METHOD(DualPlasmaTurret, tr_think, void(DualPlasmaTurret thistur, entity it))
{
+ SELFPARAM();
if ((self.tur_head.frame != 0) && (self.tur_head.frame != 3))
self.tur_head.frame = self.tur_head.frame + 1;
-#ifndef TURRET_PLASMA_WEAPON_H
-#define TURRET_PLASMA_WEAPON_H
-
-CLASS(PlasmaAttack, PortoLaunch)
-/* flags */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(PlasmaAttack, impulse, int, 5);
-/* refname */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
-/* wepname */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
-ENDCLASS(PlasmaAttack)
-REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
-
-#endif
+#include "plasma_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(PlasmaAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_PlasmaAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
- entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true);
+ entity missile = turret_projectile(SND_HAGAR_FIRE, 1, 0, DEATH_TURRET_PLASMA.m_id, PROJECTILE_ELECTRO_BEAM, true, true);
missile.missile_flags = MIF_SPLASH;
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
}
--- /dev/null
+#pragma once
+
+CLASS(PlasmaAttack, PortoLaunch)
+/* flags */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(PlasmaAttack, impulse, int, 5);
+/* refname */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
+/* wepname */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
+ENDCLASS(PlasmaAttack)
+REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
#ifndef TURRET_TESLA_H
#define TURRET_TESLA_H
-#include "tesla_weapon.qc"
+#include "tesla_weapon.qh"
CLASS(TeslaCoil, Turret)
/* spawnflags */ ATTRIB(TeslaCoil, spawnflags, int, TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
#ifdef IMPLEMENTATION
-#include "tesla_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_tesla) { if (!turret_initialize(TUR_TESLA)) remove(self); }
METHOD(TeslaCoil, tr_think, void(TeslaCoil thistur, entity it))
{
+ SELFPARAM();
if(!self.active)
{
self.tur_head.avelocity = '0 0 0';
-#ifndef TURRET_TESLA_WEAPON_H
-#define TURRET_TESLA_WEAPON_H
-
-CLASS(TeslaCoilTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(TeslaCoilTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(TeslaCoilTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(TeslaCoilTurretAttack, netname, string, "turret_tesla");
-/* wepname */ ATTRIB(TeslaCoilTurretAttack, m_name, string, _("Tesla Coil"));
-ENDCLASS(TeslaCoilTurretAttack)
-REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
-
-#endif
+#include "tesla_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(TeslaCoilTurretAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_TeslaCoilTurretAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
--- /dev/null
+#pragma once
+
+CLASS(TeslaCoilTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(TeslaCoilTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(TeslaCoilTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(TeslaCoilTurretAttack, netname, string, "turret_tesla");
+/* wepname */ ATTRIB(TeslaCoilTurretAttack, m_name, string, _("Tesla Coil"));
+ENDCLASS(TeslaCoilTurretAttack)
+REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
//#define WALKER_FANCYPATHING
-#include "walker_weapon.qc"
+#include "walker_weapon.qh"
CLASS(WalkerTurret, Turret)
/* spawnflags */ ATTRIB(WalkerTurret, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE);
#ifdef IMPLEMENTATION
-#include "walker_weapon.qc"
-
#ifdef SVQC
float autocvar_g_turrets_unit_walker_melee_damage;
return turret_firecheck();
}
-void walker_melee_do_dmg()
-{SELFPARAM();
+void walker_melee_do_dmg(entity this)
+{
vector where;
entity e;
}
}
-void walker_setnoanim()
-{SELFPARAM();
+void walker_setnoanim(entity this)
+{
turrets_setframe(ANIM_NO, false);
self.animflag = self.frame;
}
this.velocity = this.velocity + vforce;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
}
#define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it))
{
+ SELFPARAM();
fixedmakevectors(self.angles);
if (self.spawnflags & TSF_NO_PATHBREAK && self.pathcurrent)
return;
fixedmakevectors(this.angles);
- movelib_groundalign4point(300, 100, 0.25, 45);
+ movelib_groundalign4point(this, 300, 100, 0.25, 45);
setorigin(this, this.origin + this.velocity * dt);
this.tur_head.angles += dt * this.tur_head.move_avelocity;
this.angles_y = this.move_angles_y;
-#ifndef TURRET_WALKER_WEAPON_H
-#define TURRET_WALKER_WEAPON_H
-
-CLASS(WalkerTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
-/* refname */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
-/* wepname */ ATTRIB(WalkerTurretAttack, m_name, string, _("Walker"));
-ENDCLASS(WalkerTurretAttack)
-REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
-
-#endif
+#include "walker_weapon.qh"
#ifdef IMPLEMENTATION
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire))) {
if (isPlayer) {
turret_initparams(actor);
- W_SetupShot_Dir(actor, v_forward, false, 0, SND(WalkerTurretAttack_FIRE), CH_WEAPON_B, 0);
+ W_SetupShot_Dir(actor, v_forward, false, 0, SND_WalkerTurretAttack_FIRE, CH_WEAPON_B, 0);
actor.tur_shotdir_updated = w_shotdir;
actor.tur_shotorg = w_shotorg;
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
- fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
+ fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
}
}
--- /dev/null
+#pragma once
+
+CLASS(WalkerTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
+/* refname */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
+/* wepname */ ATTRIB(WalkerTurretAttack, m_name, string, _("Walker"));
+ENDCLASS(WalkerTurretAttack)
+REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
float boxesoverlap(vector m1, vector m2, vector m3, vector m4);
float boxinsidebox(vector smins, vector smaxs, vector bmins, vector bmaxs);
-typedef float(string s, vector size) textLengthUpToWidth_widthFunction_t;
-typedef float(string s) textLengthUpToLength_lenFunction_t;
+USING(textLengthUpToWidth_widthFunction_t, float(string s, vector size));
+USING(textLengthUpToLength_lenFunction_t, float(string s));
float textLengthUpToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
string textShortenToWidth(string theText, float maxWidth, vector size, textLengthUpToWidth_widthFunction_t tw);
float textLengthUpToLength(string theText, float maxWidth, textLengthUpToLength_lenFunction_t tw);
// as it may exceed 0..1 bounds, or go in reverse
float cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor);
-typedef entity(entity cur, entity near, entity pass) findNextEntityNearFunction_t;
-typedef float(entity a, entity b, entity pass) isConnectedFunction_t;
+USING(findNextEntityNearFunction_t, entity(entity cur, entity near, entity pass));
+USING(isConnectedFunction_t, float(entity a, entity b, entity pass));
void FindConnectedComponent(entity e, .entity fld, findNextEntityNearFunction_t nxt, isConnectedFunction_t iscon, entity pass);
// expand multiple arguments into one argument by stripping parenthesis
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "cl_vehicles.qc"
+#include "sv_vehicles.qc"
+++ /dev/null
-#include "vehicle/spiderbot.qc"
-#include "vehicle/raptor.qc"
-#include "vehicle/racer.qc"
-#ifndef VEHICLES_NO_UNSTABLE
- #include "vehicle/bumblebee.qc"
-#endif
#endif
#define IMPLEMENTATION
-#include "all.inc"
+#include "vehicle/_mod.inc"
#undef IMPLEMENTATION
#endif
const int VEH_FIRST = 1;
#define VEH_LAST (Vehicles_COUNT - 1)
-/** If you register a new vehicle, make sure to add it to all.inc */
#define REGISTER_VEHICLE(id, inst) REGISTER(Vehicles, VEH, id, vehicleid, inst)
#if defined(SVQC)
REGISTER_VEHICLE(Null, NEW(Vehicle));
-#include "all.inc"
+#include "vehicle/_mod.inc"
#endif
float alarm1time;
float alarm2time;
-void vehicle_alarm(entity e, int ch, string s0und)
+void vehicle_alarm(entity e, int ch, Sound s0und)
{
+ TC(Sound, s0und);
if(!autocvar_cl_vehicles_alarm)
return;
- _sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
+ sound(e, ch, s0und, VOL_BASEVOICE, ATTEN_NONE);
}
void AuxiliaryXhair_Draw2D(entity this)
if(alarm1time < time)
{
alarm1time = time + 2;
- vehicle_alarm(self, CH_PAIN_SINGLE, SND(VEH_ALARM));
+ vehicle_alarm(self, CH_PAIN_SINGLE, SND_VEH_ALARM);
}
drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
}
{
if(alarm1time)
{
- vehicle_alarm(self, CH_PAIN_SINGLE, SND(Null));
+ vehicle_alarm(self, CH_PAIN_SINGLE, SND_Null);
alarm1time = 0;
}
drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL);
if(alarm2time < time)
{
alarm2time = time + 1;
- vehicle_alarm(self, CH_TRIGGER_SINGLE, SND(VEH_ALARM_SHIELD));
+ vehicle_alarm(self, CH_TRIGGER_SINGLE, SND_VEH_ALARM_SHIELD);
}
drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
}
{
if(alarm2time)
{
- vehicle_alarm(self, CH_TRIGGER_SINGLE, SND(Null));
+ vehicle_alarm(self, CH_TRIGGER_SINGLE, SND_Null);
alarm2time = 0;
}
drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL);
void Vehicles_drawCrosshair(string crosshair)
{
- SELFPARAM();
vector tmpSize = '0 0 0';
vector tmpPos = '0 0 0';
tmpPos.x = (vid_conwidth - tmpSize.x) / 2;
tmpPos.y = (vid_conheight - tmpSize.y) / 2;
- drawpic(tmpPos, crosshair, tmpSize, '1 1 1', autocvar_crosshair_alpha, DRAWFLAG_NORMAL);
+ vector wcross_color = '1 1 1';
+ if(autocvar_cl_vehicles_crosshair_colorize)
+ wcross_color = crosshair_getcolor(NULL, STAT(VEHICLESTAT_HEALTH));
+
+ drawpic(tmpPos, crosshair, tmpSize, wcross_color, autocvar_crosshair_alpha, DRAWFLAG_NORMAL);
}
}
remove (self);
}
-entity vehicles_projectile(string _mzlfx, string _mzlsound,
+entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
vector _org, vector _vel,
float _dmg, float _radi, float _force, float _size,
int _deahtype, float _projtype, float _health,
bool _cull, bool _clianim, entity _owner)
-{SELFPARAM();
+{
+ TC(Sound, _mzlsound);
entity proj;
proj = spawn();
proj.velocity = _vel;
proj.touch = vehicles_projectile_explode;
proj.use = vehicles_projectile_explode;
- proj.owner = self;
+ proj.owner = this;
proj.realowner = _owner;
proj.think = SUB_Remove_self;
proj.nextthink = time + 30;
else
proj.flags = FL_PROJECTILE | FL_NOTARGET;
- if(_mzlsound)
- _sound (self, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
+ if(_mzlsound != SND_Null)
+ sound (this, CH_WEAPON_A, _mzlsound, VOL_BASE, ATTEN_NORM);
if(_mzlfx)
Send_Effect_(_mzlfx, proj.origin, proj.velocity, 1);
self.nextthink = time + 0.1;
}
-entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
-{SELFPARAM();
+entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
+{
entity _gib = spawn();
_setmodel(_gib, _template.model);
- vector org = gettaginfo(self, gettagindex(self, _tag));
+ vector org = gettaginfo(this, gettagindex(this, _tag));
setorigin(_gib, org);
_gib.velocity = _vel;
_gib.movetype = MOVETYPE_TOSS;
bool vehicle_addplayerslot( entity _owner,
entity _slot,
int _hud,
- string _hud_model,
- bool() _framefunc,
- void(bool) _exitfunc, float() _enterfunc)
+ Model _hud_model,
+ bool(entity) _framefunc,
+ void(bool) _exitfunc, float(entity, entity) _enterfunc)
{
if(!(_owner.vehicle_flags & VHF_MULTISLOT))
_owner.vehicle_flags |= VHF_MULTISLOT;
_slot.vehicle_hudmodel.viewmodelforclient = _slot;
_slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- _setmodel(_slot.vehicle_hudmodel, _hud_model);
+ setmodel(_slot.vehicle_hudmodel, _hud_model);
setmodel(_slot.vehicle_viewport, MDL_Null);
setattachment(_slot.vehicle_hudmodel, _slot, "");
return vtag;
}
-void vehicles_reset_colors()
-{SELFPARAM();
- entity e;
- float _effects = 0, _colormap;
- vector _glowmod, _colormod;
-
+void vehicles_reset_colors(entity this)
+{
+ int eff = 0, cmap;
+ const vector cmod = '0 0 0';
+ if(this.team && teamplay)
+ cmap = 1024 + (this.team - 1) * 17;
+ else
+ cmap = 1024;
if(autocvar_g_nodepthtestplayers)
- _effects |= EF_NODEPTHTEST;
-
+ eff |= EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- _effects |= EF_FULLBRIGHT;
-
- if(self.team)
- _colormap = 1024 + (self.team - 1) * 17;
- else
- _colormap = 1024;
-
- _glowmod = '0 0 0';
- _colormod = '0 0 0';
+ eff |= EF_FULLBRIGHT;
// Find all ents attacked to main model and setup effects, colormod etc.
- e = findchainentity(tag_entity, self);
- while(e)
+ FOREACH_ENTITY_ENT(tag_entity, this,
{
- if(e != self.vehicle_shieldent)
+ if(it != this.vehicle_shieldent)
{
- e.effects = _effects; // | EF_LOWPRECISION;
- e.colormod = _colormod;
- e.colormap = _colormap;
- e.alpha = 1;
+ it.effects = eff;
+ it.colormod = cmod;
+ it.colormap = cmap;
+ it.alpha = 1;
}
- e = e.chain;
- }
+ });
+
// Also check head tags
- e = findchainentity(tag_entity, self.tur_head);
- while(e)
+ FOREACH_ENTITY_ENT(tag_entity, this.tur_head,
{
- if(e != self.vehicle_shieldent)
+ if(it != this.vehicle_shieldent)
{
- e.effects = _effects; // | EF_LOWPRECISION;
- e.colormod = _colormod;
- e.colormap = _colormap;
- e.alpha = 1;
+ it.effects = eff;
+ it.colormod = cmod;
+ it.colormap = cmap;
+ it.alpha = 1;
}
- e = e.chain;
- }
+ });
- self.vehicle_hudmodel.effects = self.effects = _effects; // | EF_LOWPRECISION;
- self.vehicle_hudmodel.colormod = self.colormod = _colormod;
- self.vehicle_hudmodel.colormap = self.colormap = _colormap;
- self.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
+ this.vehicle_hudmodel.effects = this.effects = eff; // | EF_LOWPRECISION;
+ this.vehicle_hudmodel.colormod = this.colormod = cmod;
+ this.vehicle_hudmodel.colormap = this.colormap = cmap;
+ this.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- self.alpha = 1;
- self.avelocity = '0 0 0';
- self.velocity = '0 0 0';
- self.effects = _effects;
+ this.alpha = 1;
+ this.avelocity = '0 0 0';
+ this.velocity = '0 0 0';
+ this.effects = eff;
}
void vehicles_clearreturn(entity veh)
else
{
vehicles_setreturn(self);
- vehicles_reset_colors();
+ vehicles_reset_colors(self);
}
}
}
-void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
-{SELFPARAM();
- if(self.(regen_field) < field_max)
+void vehicles_regen(entity this, float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
+{
+ if(this.(regen_field) < field_max)
if(timer + rpause < time)
{
if(_healthscale)
- regen = regen * (self.vehicle_health / self.max_health);
+ regen = regen * (this.vehicle_health / this.max_health);
- self.(regen_field) = min(self.(regen_field) + regen * delta_time, field_max);
+ this.(regen_field) = min(this.(regen_field) + regen * delta_time, field_max);
- if(self.owner)
- self.owner.(regen_field) = (self.(regen_field) / field_max) * 100;
+ if(this.owner)
+ this.owner.(regen_field) = (this.(regen_field) / field_max) * 100;
}
}
{
if(this.owner)
if(this.vehicle_flags & VHF_DEATHEJECT)
- WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
+ WITHSELF(this, vehicles_exit(VHEF_EJECT));
else
- WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
+ WITHSELF(this, vehicles_exit(VHEF_RELEASE));
- antilag_clear(this);
+ antilag_clear(this, this);
Vehicle info = Vehicles_from(this.vehicleid);
info.vr_death(info, this);
return false;
}
-void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
-{SELFPARAM();
+void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
+{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return;
- if(self.play_time < time)
+ if(this.play_time < time)
{
- float wc = vlen(self.velocity - self.oldvelocity);
- //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
- //dprint("vel: ", vtos(self.velocity), "\n");
+ float wc = vlen(this.velocity - this.oldvelocity);
+ //dprint("oldvel: ", vtos(this.oldvelocity), "\n");
+ //dprint("vel: ", vtos(this.velocity), "\n");
if(_minspeed < wc)
{
float take = min(_speedfac * wc, _maxpain);
- Damage (self, world, world, take, DEATH_FALL.m_id, self.origin, '0 0 0');
- self.play_time = time + 0.25;
+ Damage (this, world, world, take, DEATH_FALL.m_id, this.origin, '0 0 0');
+ this.play_time = time + 0.25;
//dprint("wc: ", ftos(wc), "\n");
//dprint("take: ", ftos(take), "\n");
_vehicle.vehicle_exit(eject);
vehicles_setreturn(_vehicle);
- vehicles_reset_colors();
+ vehicles_reset_colors(_vehicle);
_vehicle.owner = world;
CSQCMODEL_AUTOINIT(self);
}
void vehicles_enter(entity pl, entity veh)
-{SELFPARAM();
+{
+ SELFPARAM();
+ entity oldself = self;
+
// Remove this when bots know how to use vehicles
if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots))
return;
if(veh.vehicle_flags & VHF_MULTISLOT)
if(veh.owner)
{
- setself(veh);
- other = pl; // TODO: fix
-
if(!veh.gunner1)
if(time >= veh.gun1.phase)
if(veh.gun1.vehicle_enter)
- if(veh.gun1.vehicle_enter())
- {
- setself(this);
+ if(veh.gun1.vehicle_enter(veh, pl))
return;
- }
if(!veh.gunner2)
if(time >= veh.gun2.phase)
if(veh.gun2.vehicle_enter)
- if(veh.gun2.vehicle_enter())
- {
- setself(this);
+ if(veh.gun2.vehicle_enter(veh, pl))
return;
- }
-
- setself(this);
}
if(teamplay)
CSQCModel_UnlinkEntity(veh);
Vehicle info = Vehicles_from(veh.vehicleid);
info.vr_enter(info, veh);
- setself(this);
+ setself(oldself);
- antilag_clear(pl);
+ antilag_clear(pl, CS(pl));
}
void vehicles_think()
FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == self, RemoveGrapplingHook(it));
- vehicles_reset_colors();
+ vehicles_reset_colors(self);
Vehicle info = Vehicles_from(self.vehicleid);
info.vr_spawn(info, self);
CSQCMODEL_AUTOINIT(self);
}
-bool vehicle_initialize(entity veh, bool nodrop)
-{SELFPARAM();
+bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
+{
if(!autocvar_g_vehicles)
return false;
- if(!veh.vehicleid)
+ if(!info.vehicleid)
return false;
- if(!veh.tur_head) {
- Vehicle info = Vehicles_from(veh.vehicleid);
+ if(!this.tur_head)
info.vr_precache(info);
- }
- if(self.targetname && self.targetname != "")
+ if(this.targetname && this.targetname != "")
{
- self.vehicle_controller = find(world, target, self.targetname);
- if(!self.vehicle_controller)
+ this.vehicle_controller = find(world, target, this.targetname);
+ if(!this.vehicle_controller)
{
bprint("^1WARNING: ^7Vehicle with invalid .targetname\n");
- self.active = ACTIVE_ACTIVE;
+ this.active = ACTIVE_ACTIVE;
}
else
{
- self.team = self.vehicle_controller.team;
- self.use = vehicle_use;
+ this.team = this.vehicle_controller.team;
+ this.use = vehicle_use;
if(teamplay)
{
- if(self.vehicle_controller.team == 0)
- self.active = ACTIVE_NOT;
+ if(this.vehicle_controller.team == 0)
+ this.active = ACTIVE_NOT;
else
- self.active = ACTIVE_ACTIVE;
+ this.active = ACTIVE_ACTIVE;
}
}
}
- else { self.active = ACTIVE_ACTIVE; }
+ else { this.active = ACTIVE_ACTIVE; }
- if(self.team && (!teamplay || !autocvar_g_vehicles_teams))
- self.team = 0;
+ if(this.team && (!teamplay || !autocvar_g_vehicles_teams))
+ this.team = 0;
- if(self.mdl == "" || !self.mdl)
- _setmodel(self, veh.model);
+ if(this.mdl == "" || !this.mdl)
+ _setmodel(this, info.model);
else
- _setmodel(self, self.mdl);
-
- self.vehicle_flags |= VHF_ISVEHICLE;
-
- self.vehicle_viewport = new(vehicle_viewport);
- self.vehicle_hudmodel = new(vehicle_hudmodel);
- self.tur_head = new(tur_head);
- self.tur_head.owner = self;
- self.takedamage = DAMAGE_NO;
- self.bot_attack = true;
- self.iscreature = true;
- self.teleportable = false; // no teleporting for vehicles, too buggy
- self.damagedbycontents = true;
- self.vehicleid = veh.vehicleid;
- self.PlayerPhysplug = veh.PlayerPhysplug;
- self.event_damage = func_null;
- self.touch = vehicles_touch;
- self.think = vehicles_spawn;
- self.nextthink = time;
- self.effects = EF_NODRAW;
- self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
+ _setmodel(this, this.mdl);
+
+ this.vehicle_flags |= VHF_ISVEHICLE;
+
+ this.vehicle_viewport = new(vehicle_viewport);
+ this.vehicle_hudmodel = new(vehicle_hudmodel);
+ this.tur_head = new(tur_head);
+ this.tur_head.owner = this;
+ this.takedamage = DAMAGE_NO;
+ this.bot_attack = true;
+ this.iscreature = true;
+ this.teleportable = false; // no teleporting for vehicles, too buggy
+ this.damagedbycontents = true;
+ this.vehicleid = info.vehicleid;
+ this.PlayerPhysplug = info.PlayerPhysplug;
+ this.event_damage = func_null;
+ this.touch = vehicles_touch;
+ this.think = vehicles_spawn;
+ this.nextthink = time;
+ this.effects = EF_NODRAW;
+ this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
if(autocvar_g_playerclip_collisions)
- self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+ this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
if(autocvar_g_nodepthtestplayers)
- self.effects |= EF_NODEPTHTEST;
+ this.effects |= EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- self.effects |= EF_FULLBRIGHT;
+ this.effects |= EF_FULLBRIGHT;
- _setmodel(self.vehicle_hudmodel, veh.hud_model);
- setmodel(self.vehicle_viewport, MDL_Null);
+ _setmodel(this.vehicle_hudmodel, info.hud_model);
+ setmodel(this.vehicle_viewport, MDL_Null);
- if(veh.head_model != "")
+ if(info.head_model != "")
{
- _setmodel(self.tur_head, veh.head_model);
- setattachment(self.tur_head, self, veh.tag_head);
- setattachment(self.vehicle_hudmodel, self.tur_head, veh.tag_hud);
- setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+ _setmodel(this.tur_head, info.head_model);
+ setattachment(this.tur_head, this, info.tag_head);
+ setattachment(this.vehicle_hudmodel, this.tur_head, info.tag_hud);
+ setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
}
else
{
- setattachment(self.tur_head, self, "");
- setattachment(self.vehicle_hudmodel, self, veh.tag_hud);
- setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+ setattachment(this.tur_head, this, "");
+ setattachment(this.vehicle_hudmodel, this, info.tag_hud);
+ setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
}
- setsize(self, veh.mins, veh.maxs);
+ setsize(this, info.mins, info.maxs);
if(!nodrop)
{
- setorigin(self, self.origin);
- tracebox(self.origin + '0 0 100', veh.mins, veh.maxs, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
- setorigin(self, trace_endpos);
+ setorigin(this, this.origin);
+ tracebox(this.origin + '0 0 100', info.mins, info.maxs, this.origin - '0 0 10000', MOVE_WORLDONLY, this);
+ setorigin(this, trace_endpos);
}
- self.pos1 = self.origin;
- self.pos2 = self.angles;
- self.tur_head.team = self.team;
+ this.pos1 = this.origin;
+ this.pos2 = this.angles;
+ this.tur_head.team = this.team;
- Vehicle info = Vehicles_from(veh.vehicleid);
- info.vr_setup(info, veh);
+ info.vr_setup(info, this);
- if(self.active == ACTIVE_NOT)
- self.nextthink = 0; // wait until activated
+ if(this.active == ACTIVE_NOT)
+ this.nextthink = 0; // wait until activated
else if(autocvar_g_vehicles_delayspawn)
- self.nextthink = time + self.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+ this.nextthink = time + this.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
else
- self.nextthink = time + game_starttime;
+ this.nextthink = time + game_starttime;
- if(MUTATOR_CALLHOOK(VehicleSpawn))
+ if(MUTATOR_CALLHOOK(VehicleSpawn, this))
return false;
return true;
#define VEHICLES_DEF_H
#ifdef SVQC
-#include "../turrets/sv_turrets.qh"
+#include <common/turrets/sv_turrets.qh>
+#include "vehicle.qh"
// vehicle cvars
-float autocvar_g_vehicles;
-float autocvar_g_vehicles_enter;
-float autocvar_g_vehicles_enter_radius;
-float autocvar_g_vehicles_steal;
-float autocvar_g_vehicles_steal_show_waypoint;
-float autocvar_g_vehicles_crush_dmg;
-float autocvar_g_vehicles_crush_force;
-float autocvar_g_vehicles_delayspawn;
-float autocvar_g_vehicles_delayspawn_jitter;
+bool autocvar_g_vehicles = true;
+AUTOCVAR(g_vehicles_enter, bool, false, "require pressing use key to enter a vehicle");
+float autocvar_g_vehicles_enter_radius = 250;
+AUTOCVAR(g_vehicles_steal, bool, true, "allow stealing enemy vehicles in teamplay modes");
+AUTOCVAR(g_vehicles_steal_show_waypoint, bool, true, "show a waypoint above the thief");
+float autocvar_g_vehicles_crush_dmg = 70;
+float autocvar_g_vehicles_crush_force = 50;
+bool autocvar_g_vehicles_delayspawn = true;
+float autocvar_g_vehicles_delayspawn_jitter = 10;
float autocvar_g_vehicles_allow_bots;
-float autocvar_g_vehicles_teams;
+
+AUTOCVAR(g_vehicles_teams, bool, true, "allow team specific vehicles");
float autocvar_g_vehicles_teleportable;
float autocvar_g_vehicles_vortex_damagerate = 0.5;
float autocvar_g_vehicles_machinegun_damagerate = 0.5;
.bool(int _imp) vehicles_impulse;
.int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
.void(int exit_flags) vehicle_exit;
-.bool() vehicle_enter;
+.bool(entity this, entity player) vehicle_enter;
const int VHEF_NORMAL = 0; /// User pressed exit key
const int VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying
const int VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
float vehicles_exit_running;
// macros
-#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
- ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
+#define VEHICLE_UPDATE_PLAYER(ply,vehi,fld,vhname) \
+ ply.vehicle_##fld = (vehi.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
.float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
void vehicles_exit(float eject);
-float vehicle_initialize(entity vehicle, float nodrop);
+bool vehicle_initialize(entity this, Vehicle info, float nodrop);
bool vehicle_impulse(entity this, int imp);
bool vehicles_crushable(entity e);
/** cockpit model tag */
ATTRIB(Vehicle, tag_view, string, string_null)
/** player physics mod */
- ATTRIB(Vehicle, PlayerPhysplug, int(), func_null)
+ ATTRIB(Vehicle, PlayerPhysplug, bool(entity), func_null)
/** */
ATTRIB(Vehicle, spawnflags, int, 0)
/** vehicle hitbox size */
--- /dev/null
+// generated file; do not modify
+#include "bumblebee.qc"
+#include "bumblebee_weapons.qc"
+#include "racer.qc"
+#include "racer_weapon.qc"
+#include "raptor.qc"
+#include "raptor_weapons.qc"
+#include "spiderbot.qc"
+#include "spiderbot_weapons.qc"
#define VEHICLE_BUMBLEBEE
#include "bumblebee.qh"
-#include "bumblebee_weapons.qc"
+#include "bumblebee_weapons.qh"
CLASS(Bumblebee, Vehicle)
/* spawnflags */ ATTRIB(Bumblebee, spawnflags, int, VHF_DMGSHAKE);
ENDCLASS(Bumblebee)
REGISTER_VEHICLE(BUMBLEBEE, NEW(Bumblebee));
+#ifndef MENUQC
+ MODEL(VEH_BUMBLEBEE_GUNCOCKPIT, "models/vehicles/wakizashi_cockpit.dpm");
+#endif
+
#endif
#ifdef IMPLEMENTATION
const float BRG_START = 4;
const float BRG_END = 8;
-#include "bumblebee_weapons.qc"
-
#ifdef SVQC
-float autocvar_g_vehicle_bumblebee_speed_forward;
-float autocvar_g_vehicle_bumblebee_speed_strafe;
-float autocvar_g_vehicle_bumblebee_speed_up;
-float autocvar_g_vehicle_bumblebee_speed_down;
-float autocvar_g_vehicle_bumblebee_turnspeed;
-float autocvar_g_vehicle_bumblebee_pitchspeed;
-float autocvar_g_vehicle_bumblebee_pitchlimit;
-float autocvar_g_vehicle_bumblebee_friction;
-
-float autocvar_g_vehicle_bumblebee_energy;
-float autocvar_g_vehicle_bumblebee_energy_regen;
-float autocvar_g_vehicle_bumblebee_energy_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_health;
-float autocvar_g_vehicle_bumblebee_health_regen;
-float autocvar_g_vehicle_bumblebee_health_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_shield;
-float autocvar_g_vehicle_bumblebee_shield_regen;
-float autocvar_g_vehicle_bumblebee_shield_regen_pause;
-
-float autocvar_g_vehicle_bumblebee_cannon_ammo;
-float autocvar_g_vehicle_bumblebee_cannon_ammo_regen;
-float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause;
+float autocvar_g_vehicle_bumblebee_respawntime = 60;
-float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
+float autocvar_g_vehicle_bumblebee_speed_forward = 350;
+float autocvar_g_vehicle_bumblebee_speed_strafe = 350;
+float autocvar_g_vehicle_bumblebee_speed_up = 350;
+float autocvar_g_vehicle_bumblebee_speed_down = 350;
+float autocvar_g_vehicle_bumblebee_turnspeed = 120;
+float autocvar_g_vehicle_bumblebee_pitchspeed = 60;
+float autocvar_g_vehicle_bumblebee_pitchlimit = 60;
+float autocvar_g_vehicle_bumblebee_friction = 0.5;
-float autocvar_g_vehicle_bumblebee_cannon_turnspeed;
-float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down;
-float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up;
-float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
-float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
+float autocvar_g_vehicle_bumblebee_energy = 500;
+float autocvar_g_vehicle_bumblebee_energy_regen = 50;
+float autocvar_g_vehicle_bumblebee_energy_regen_pause = 1;
+float autocvar_g_vehicle_bumblebee_health = 1000;
+float autocvar_g_vehicle_bumblebee_health_regen = 65;
+float autocvar_g_vehicle_bumblebee_health_regen_pause = 10;
-float autocvar_g_vehicle_bumblebee_raygun_turnspeed;
-float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down;
-float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up;
-float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides;
+float autocvar_g_vehicle_bumblebee_shield = 400;
+float autocvar_g_vehicle_bumblebee_shield_regen = 150;
+float autocvar_g_vehicle_bumblebee_shield_regen_pause = 0.75;
-float autocvar_g_vehicle_bumblebee_raygun_range;
-float autocvar_g_vehicle_bumblebee_raygun_dps;
-float autocvar_g_vehicle_bumblebee_raygun_aps;
-float autocvar_g_vehicle_bumblebee_raygun_fps;
+float autocvar_g_vehicle_bumblebee_cannon_ammo = 100;
+float autocvar_g_vehicle_bumblebee_cannon_ammo_regen = 100;
+float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause = 1;
-float autocvar_g_vehicle_bumblebee_raygun;
-float autocvar_g_vehicle_bumblebee_healgun_hps;
-float autocvar_g_vehicle_bumblebee_healgun_hmax;
-float autocvar_g_vehicle_bumblebee_healgun_aps;
-float autocvar_g_vehicle_bumblebee_healgun_amax;
-float autocvar_g_vehicle_bumblebee_healgun_sps;
-float autocvar_g_vehicle_bumblebee_healgun_locktime;
+float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
-float autocvar_g_vehicle_bumblebee_respawntime;
+float autocvar_g_vehicle_bumblebee_cannon_turnspeed = 160;
+float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down = 60;
+float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up = 60;
+float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in = 20;
+float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out = 80;
-float autocvar_g_vehicle_bumblebee_blowup_radius;
-float autocvar_g_vehicle_bumblebee_blowup_coredamage;
-float autocvar_g_vehicle_bumblebee_blowup_edgedamage;
-float autocvar_g_vehicle_bumblebee_blowup_forceintensity;
-vector autocvar_g_vehicle_bumblebee_bouncepain;
-bool autocvar_g_vehicle_bumblebee = 0;
+float autocvar_g_vehicle_bumblebee_raygun_turnspeed = 180;
+float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down = 20;
+float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up = 5;
+float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides = 35;
-float bumblebee_gunner_frame()
-{SELFPARAM();
- entity vehic = self.vehicle.owner;
- entity gun = self.vehicle;
- entity gunner = self;
- setself(vehic);
+bool autocvar_g_vehicle_bumblebee_raygun = false;
+float autocvar_g_vehicle_bumblebee_raygun_range = 2048;
+float autocvar_g_vehicle_bumblebee_raygun_dps = 250;
+float autocvar_g_vehicle_bumblebee_raygun_aps = 100;
+float autocvar_g_vehicle_bumblebee_raygun_fps = 100;
+
+float autocvar_g_vehicle_bumblebee_healgun_hps = 150;
+float autocvar_g_vehicle_bumblebee_healgun_hmax = 100;
+float autocvar_g_vehicle_bumblebee_healgun_aps = 75;
+float autocvar_g_vehicle_bumblebee_healgun_amax = 100;
+float autocvar_g_vehicle_bumblebee_healgun_sps = 100;
+float autocvar_g_vehicle_bumblebee_healgun_locktime = 2.5;
+
+float autocvar_g_vehicle_bumblebee_blowup_radius = 500;
+float autocvar_g_vehicle_bumblebee_blowup_coredamage = 500;
+float autocvar_g_vehicle_bumblebee_blowup_edgedamage = 100;
+float autocvar_g_vehicle_bumblebee_blowup_forceintensity = 600;
+vector autocvar_g_vehicle_bumblebee_bouncepain = '1 100 200';
+
+bool autocvar_g_vehicle_bumblebee = true;
+
+bool bumblebee_gunner_frame(entity this)
+{
+ entity vehic = this.vehicle.owner;
+ entity gun = this.vehicle;
+ return = true;
// this isn't technically a vehicle (yet), let's not do frame functions on it (yet)
//vehicles_frame(gun, player);
vehic.solid = SOLID_NOT;
- //setorigin(gunner, vehic.origin);
- gunner.velocity = vehic.velocity;
+ //setorigin(this, vehic.origin);
+ this.velocity = vehic.velocity;
float _in, _out;
vehic.angles_x *= -1;
{
_in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
_out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
- setorigin(gunner, vehic.origin + v_up * -16 + v_forward * -16 + v_right * 128);
+ setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * 128);
}
else
{
_in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
_out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
- setorigin(gunner, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
+ setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
}
- crosshair_trace(gunner);
+ crosshair_trace(this);
vector _ct = trace_endpos;
vector ad;
if(trace_ent.takedamage)
if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
{
- if(DIFF_TEAM(trace_ent, gunner))
+ if(DIFF_TEAM(trace_ent, this))
{
gun.enemy = trace_ent;
gun.lock_time = time + 5;
ad = vf;
- distance = vlen(ad - gunner.origin);
+ distance = vlen(ad - this.origin);
impact_time = distance / autocvar_g_vehicle_bumblebee_cannon_speed;
ad = vf + _vel * impact_time;
trace_endpos = ad;
- UpdateAuxiliaryXhair(gunner, ad, '1 0 1', 1);
+ UpdateAuxiliaryXhair(this, ad, '1 0 1', 1);
vehicle_aimturret(vehic, trace_endpos, gun, "fire",
autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
_out * -1, _in, autocvar_g_vehicle_bumblebee_cannon_turnspeed);
autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
_out * -1, _in, autocvar_g_vehicle_bumblebee_cannon_turnspeed);
- if(!forbidWeaponUse(gunner))
- if(PHYS_INPUT_BUTTON_ATCK(gunner))
+ if(!forbidWeaponUse(this))
+ if(PHYS_INPUT_BUTTON_ATCK(this))
if(time > gun.attack_finished_single[0])
if(gun.vehicle_energy >= autocvar_g_vehicle_bumblebee_cannon_cost)
{
gun.vehicle_energy -= autocvar_g_vehicle_bumblebee_cannon_cost;
- bumblebee_fire_cannon(gun, "fire", gunner);
+ bumblebee_fire_cannon(vehic, gun, "fire", this);
gun.delay = time;
gun.attack_finished_single[0] = time + autocvar_g_vehicle_bumblebee_cannon_refire;
}
- VEHICLE_UPDATE_PLAYER(gunner, health, bumblebee);
+ VEHICLE_UPDATE_PLAYER(this, vehic, health, bumblebee);
if(vehic.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(gunner, shield, bumblebee);
+ VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
ad = gettaginfo(gun, gettagindex(gun, "fire"));
traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, gun);
- UpdateAuxiliaryXhair(gunner, trace_endpos, ('1 0 0' * gunner.vehicle_reload1) + ('0 1 0' *(1 - gunner.vehicle_reload1)), 0);
+ UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), 0);
if(vehic.owner)
- UpdateAuxiliaryXhair(vehic.owner, trace_endpos, ('1 0 0' * gunner.vehicle_reload1) + ('0 1 0' *(1 - gunner.vehicle_reload1)), ((gunner == vehic.gunner1) ? 1 : 2));
+ UpdateAuxiliaryXhair(vehic.owner, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), ((this == vehic.gunner1) ? 1 : 2));
vehic.solid = SOLID_BBOX;
- PHYS_INPUT_BUTTON_ATCK(gunner) = PHYS_INPUT_BUTTON_ATCK2(gunner) = PHYS_INPUT_BUTTON_CROUCH(gunner) = false;
- gunner.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
-
- setself(gunner);
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
+ this.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
}
vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity player)
player.vehicle = world;
}
-bool bumblebee_gunner_enter()
-{SELFPARAM();
- entity vehic = self;
- entity player = other;
+bool bumblebee_gunner_enter(entity this, entity player)
+{
+ entity vehic = this;
entity gunner = world;
if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
float phase_time = (time >= self.gun1.phase) + (time >= self.gun2.phase);
if(time >= other.vehicle_enter_delay && phase_time)
- if(bumblebee_gunner_enter())
+ if(bumblebee_gunner_enter(self, other))
return;
}
vehicles_touch();
}
-void bumblebee_regen()
-{SELFPARAM();
- if(self.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
- self.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
- self.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
+void bumblebee_regen(entity this)
+{
+ if(this.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
+ this.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
+ this.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
- if(self.gun2.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
- self.gun2.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
- self.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
+ if(this.gun2.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
+ this.gun2.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
+ this.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
- if(self.vehicle_flags & VHF_SHIELDREGEN)
- vehicles_regen(self.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, true);
+ if(this.vehicle_flags & VHF_SHIELDREGEN)
+ vehicles_regen(this, this.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, frametime, true);
- if(self.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(self.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, false);
+ if(this.vehicle_flags & VHF_HEALTHREGEN)
+ vehicles_regen(this, this.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, frametime, false);
- if(self.vehicle_flags & VHF_ENERGYREGEN)
- vehicles_regen(self.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, false);
+ if(this.vehicle_flags & VHF_ENERGYREGEN)
+ vehicles_regen(this, this.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, frametime, false);
}
-float bumblebee_pilot_frame()
-{SELFPARAM();
- entity pilot, vehic;
- vector newvel;
+bool bumblebee_pilot_frame(entity this)
+{
+ entity vehic = this.vehicle;
+ return = true;
if(intermission_running)
{
- self.vehicle.velocity = '0 0 0';
- self.vehicle.avelocity = '0 0 0';
- return 1;
+ vehic.velocity = '0 0 0';
+ vehic.avelocity = '0 0 0';
+ return;
}
- pilot = self;
- vehic = self.vehicle;
- setself(vehic);
-
- vehicles_frame(vehic, pilot);
+ vehicles_frame(vehic, this);
if(IS_DEAD(vehic))
{
- setself(pilot);
- PHYS_INPUT_BUTTON_ATCK(pilot) = PHYS_INPUT_BUTTON_ATCK2(pilot) = false;
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ return;
}
- bumblebee_regen();
+ bumblebee_regen(vehic);
- crosshair_trace(pilot);
+ crosshair_trace(this);
- vector vang;
- float ftmp;
-
- vang = vehic.angles;
- newvel = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
+ vector vang = vehic.angles;
+ vector newvel = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
vang.x *= -1;
newvel.x *= -1;
if(newvel.x > 180) newvel.x -= 360;
if(newvel.y > 180) newvel.y -= 360;
if(newvel.y < -180) newvel.y += 360;
- ftmp = shortangle_f(pilot.v_angle.y - vang.y, vang.y);
+ float ftmp = shortangle_f(this.v_angle.y - vang.y, vang.y);
if(ftmp > 180) ftmp -= 360;
if(ftmp < -180) ftmp += 360;
vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity.y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed);
// Pitch
ftmp = 0;
- if(pilot.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
+ if(this.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
ftmp = 4;
- else if(pilot.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+ else if(this.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
ftmp = -8;
newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
makevectors('0 1 0' * vehic.angles.y);
newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
- if(pilot.movement.x != 0)
+ if(this.movement.x != 0)
{
- if(pilot.movement.x > 0)
+ if(this.movement.x > 0)
newvel += v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
- else if(pilot.movement.x < 0)
+ else if(this.movement.x < 0)
newvel -= v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
}
- if(pilot.movement.y != 0)
+ if(this.movement.y != 0)
{
- if(pilot.movement.y < 0)
+ if(this.movement.y < 0)
newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
- else if(pilot.movement.y > 0)
+ else if(this.movement.y > 0)
newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
ftmp = newvel * v_right;
ftmp *= frametime * 0.1;
vehic.angles_z = 0;
}
- if(PHYS_INPUT_BUTTON_CROUCH(pilot))
+ if(PHYS_INPUT_BUTTON_CROUCH(this))
newvel -= v_up * autocvar_g_vehicle_bumblebee_speed_down;
- else if(PHYS_INPUT_BUTTON_JUMP(pilot))
+ else if(PHYS_INPUT_BUTTON_JUMP(this))
newvel += v_up * autocvar_g_vehicle_bumblebee_speed_up;
vehic.velocity += newvel * frametime;
- pilot.velocity = pilot.movement = vehic.velocity;
+ this.velocity = this.movement = vehic.velocity;
if(autocvar_g_vehicle_bumblebee_healgun_locktime)
{
if(teamplay)
{
- if(trace_ent.team == pilot.team)
+ if(trace_ent.team == this.team)
{
vehic.tur_head.enemy = trace_ent;
vehic.tur_head.lock_time = time + autocvar_g_vehicle_bumblebee_healgun_locktime;
if(vehic.tur_head.enemy)
{
trace_endpos = real_origin(vehic.tur_head.enemy);
- UpdateAuxiliaryXhair(pilot, trace_endpos, '0 0.75 0', 0);
+ UpdateAuxiliaryXhair(this, trace_endpos, '0 0.75 0', 0);
}
}
- vang = vehicle_aimturret(vehic, trace_endpos, self.gun3, "fire",
+ vang = vehicle_aimturret(vehic, trace_endpos, vehic.gun3, "fire",
autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up,
autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1, autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides, autocvar_g_vehicle_bumblebee_raygun_turnspeed);
- if(!forbidWeaponUse(pilot))
- if((PHYS_INPUT_BUTTON_ATCK(pilot) || PHYS_INPUT_BUTTON_ATCK2(pilot)) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime || autocvar_g_vehicle_bumblebee_raygun == 0))
+ if(!forbidWeaponUse(this))
+ if((PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this)) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime || autocvar_g_vehicle_bumblebee_raygun == 0))
{
- vehic.gun3.enemy.realowner = pilot;
+ vehic.gun3.enemy.realowner = this;
vehic.gun3.enemy.effects &= ~EF_NODRAW;
vehic.gun3.enemy.hook_start = gettaginfo(vehic.gun3, gettagindex(vehic.gun3, "fire"));
{
if(autocvar_g_vehicle_bumblebee_raygun)
{
- Damage(trace_ent, vehic, pilot, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC.m_id, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime);
+ Damage(trace_ent, vehic, this, autocvar_g_vehicle_bumblebee_raygun_dps * sys_frametime, DEATH_GENERIC.m_id, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * sys_frametime);
vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_raygun_aps * sys_frametime;
}
else
{
if(!IS_DEAD(trace_ent))
- if((teamplay && trace_ent.team == pilot.team) || !teamplay)
+ if((teamplay && trace_ent.team == this.team) || !teamplay)
{
if(trace_ent.vehicle_flags & VHF_ISVEHICLE)
}
*/
- VEHICLE_UPDATE_PLAYER(pilot, health, bumblebee);
- VEHICLE_UPDATE_PLAYER(pilot, energy, bumblebee);
+ VEHICLE_UPDATE_PLAYER(this, vehic, health, bumblebee);
+ VEHICLE_UPDATE_PLAYER(this, vehic, energy, bumblebee);
- pilot.vehicle_ammo1 = (vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
- pilot.vehicle_ammo2 = (vehic.gun2.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
+ this.vehicle_ammo1 = (vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
+ this.vehicle_ammo2 = (vehic.gun2.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
if(vehic.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(pilot, shield, bumblebee);
+ VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
vehic.angles_x *= -1;
makevectors(vehic.angles);
vehic.angles_x *= -1;
- setorigin(pilot, vehic.origin + v_up * 48 + v_forward * 160);
-
- PHYS_INPUT_BUTTON_ATCK(pilot) = PHYS_INPUT_BUTTON_ATCK2(pilot) = PHYS_INPUT_BUTTON_CROUCH(pilot) = false;
- setself(pilot);
+ setorigin(this, vehic.origin + v_up * 48 + v_forward * 160);
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
void bumblebee_land()
self.owner.velocity_z += 10;
setorigin(self.owner, spot);
- antilag_clear(self.owner);
+ antilag_clear(self.owner, CS(self.owner));
self.owner = world;
}
spawnfunc(vehicle_bumblebee)
{
- if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
- if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_bumblebee) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_BUMBLEBEE, false)) { remove(this); return; }
}
METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
{
if(autocvar_g_vehicle_bumblebee_bouncepain)
- vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
}
METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
{
}
METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
{
+ SELFPARAM();
entity oldself = self;
setself(instance);
self.vehicle_exit(VHEF_EJECT);
fixedmakevectors(self.angles);
- vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
- vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
- vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+ vehicle_tossgib(instance, self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+ vehicle_tossgib(instance, self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+ vehicle_tossgib(instance, self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
- entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+ entity _body = vehicle_tossgib(instance, self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
if(random() > 0.5)
_body.touch = bumblebee_blowup;
setorigin(self.gun3, ofs);
self.angles = self.gun3.pos1;
- vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
- vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+ vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+ vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
setorigin(self.vehicle_hudmodel, '50 0 -5'); // Move cockpit forward - down.
setorigin(self.vehicle_viewport, '5 0 2'); // Move camera forward up
}
METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_bumblebee_energy)
if(autocvar_g_vehicle_bumblebee_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_bumblebee_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_bumblebee_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_bumblebee_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.vehicle_exit = bumblebee_exit;
- self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
- self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
- self.max_health = self.vehicle_health;
- self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+ instance.vehicle_exit = bumblebee_exit;
+ instance.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+ instance.max_health = instance.vehicle_health;
+ instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
}
#endif // SVQC
void CSQC_BUMBLE_GUN_HUD();
#endif
+#ifdef SVQC
+float raptor_altitude(float amax);
+#endif
+
#endif
-#ifndef VEHICLE_BUMBLEBEE_WEAPONS_H
-#define VEHICLE_BUMBLEBEE_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-#endif
+#include "bumblebee_weapons.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_bumblebee_cannon_cost;
-float autocvar_g_vehicle_bumblebee_cannon_damage;
-float autocvar_g_vehicle_bumblebee_cannon_radius;
-float autocvar_g_vehicle_bumblebee_cannon_refire;
-float autocvar_g_vehicle_bumblebee_cannon_speed;
-float autocvar_g_vehicle_bumblebee_cannon_spread;
-float autocvar_g_vehicle_bumblebee_cannon_force;
-
-bool bumble_raygun_send(entity this, entity to, int sf);
-
-void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner)
+void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner)
{
vector v = gettaginfo(_gun, gettagindex(_gun, _tagname));
- vehicles_projectile(EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND(VEH_BUMBLEBEE_FIRE),
+ vehicles_projectile(this, EFFECT_BIGPLASMA_MUZZLEFLASH.eent_eff_name, SND_VEH_BUMBLEBEE_FIRE,
v, normalize(v_forward + randomvec() * autocvar_g_vehicle_bumblebee_cannon_spread) * autocvar_g_vehicle_bumblebee_cannon_speed,
autocvar_g_vehicle_bumblebee_cannon_damage, autocvar_g_vehicle_bumblebee_cannon_radius, autocvar_g_vehicle_bumblebee_cannon_force, 0,
DEATH_VH_BUMB_GUN.m_id, PROJECTILE_BUMBLE_GUN, 0, true, true, _owner);
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+float autocvar_g_vehicle_bumblebee_cannon_cost = 2;
+float autocvar_g_vehicle_bumblebee_cannon_damage = 60;
+float autocvar_g_vehicle_bumblebee_cannon_radius = 225;
+float autocvar_g_vehicle_bumblebee_cannon_refire = 0.2;
+float autocvar_g_vehicle_bumblebee_cannon_speed = 20000;
+float autocvar_g_vehicle_bumblebee_cannon_spread = 0.02;
+float autocvar_g_vehicle_bumblebee_cannon_force = -35;
+
+#ifdef SVQC
+void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner);
+bool bumble_raygun_send(entity this, entity to, int sf);
+#endif
#ifndef VEHICLE_RACER
#define VEHICLE_RACER
-#include "racer_weapon.qc"
+#include "racer_weapon.qh"
CLASS(Racer, Vehicle)
/* spawnflags */ ATTRIB(Racer, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
#ifdef IMPLEMENTATION
-#include "racer_weapon.qc"
-
#ifdef SVQC
#include <common/triggers/trigger/impulse.qh>
-bool autocvar_g_vehicle_racer;
+bool autocvar_g_vehicle_racer = true;
-float autocvar_g_vehicle_racer_speed_afterburn;
-float autocvar_g_vehicle_racer_afterburn_cost;
+float autocvar_g_vehicle_racer_speed_afterburn = 3000;
+// energy consumed per second
+float autocvar_g_vehicle_racer_afterburn_cost = 100;
-float autocvar_g_vehicle_racer_waterburn_cost;
-float autocvar_g_vehicle_racer_waterburn_speed;
+float autocvar_g_vehicle_racer_waterburn_cost = 5;
+float autocvar_g_vehicle_racer_waterburn_speed = 750;
-float autocvar_g_vehicle_racer_water_speed_forward;
-float autocvar_g_vehicle_racer_water_speed_strafe;
+float autocvar_g_vehicle_racer_water_speed_forward = 600;
+float autocvar_g_vehicle_racer_water_speed_strafe = 600;
float autocvar_g_vehicle_racer_pitchlimit = 30;
float autocvar_g_vehicle_racer_water_downforce = 0.03;
float autocvar_g_vehicle_racer_water_upforcedamper = 15;
-float autocvar_g_vehicle_racer_anglestabilizer;
-float autocvar_g_vehicle_racer_downforce;
+float autocvar_g_vehicle_racer_anglestabilizer = 1.75;
+float autocvar_g_vehicle_racer_downforce = 0.01;
-float autocvar_g_vehicle_racer_speed_forward;
-float autocvar_g_vehicle_racer_speed_strafe;
-float autocvar_g_vehicle_racer_springlength;
-float autocvar_g_vehicle_racer_upforcedamper;
-float autocvar_g_vehicle_racer_friction;
+float autocvar_g_vehicle_racer_speed_forward = 650;
+float autocvar_g_vehicle_racer_speed_strafe = 650;
+float autocvar_g_vehicle_racer_springlength = 70;
+float autocvar_g_vehicle_racer_upforcedamper = 10;
+float autocvar_g_vehicle_racer_friction = 0.45;
float autocvar_g_vehicle_racer_water_time = 5;
-float autocvar_g_vehicle_racer_hovertype;
-float autocvar_g_vehicle_racer_hoverpower;
+float autocvar_g_vehicle_racer_collision_multiplier = 0.05;
+
+// 0 = hover, != 0 = maglev
+int autocvar_g_vehicle_racer_hovertype = 0;
+// NOTE!! x 4 (4 engines)
+float autocvar_g_vehicle_racer_hoverpower = 8000;
-float autocvar_g_vehicle_racer_turnroll;
-float autocvar_g_vehicle_racer_turnspeed;
-float autocvar_g_vehicle_racer_pitchspeed;
+float autocvar_g_vehicle_racer_turnroll = 30;
+float autocvar_g_vehicle_racer_turnspeed = 220;
+float autocvar_g_vehicle_racer_pitchspeed = 125;
-float autocvar_g_vehicle_racer_energy;
-float autocvar_g_vehicle_racer_energy_regen;
-float autocvar_g_vehicle_racer_energy_regen_pause;
+float autocvar_g_vehicle_racer_energy = 100;
+float autocvar_g_vehicle_racer_energy_regen = 50;
+float autocvar_g_vehicle_racer_energy_regen_pause = 1;
-float autocvar_g_vehicle_racer_health;
-float autocvar_g_vehicle_racer_health_regen;
-float autocvar_g_vehicle_racer_health_regen_pause;
+float autocvar_g_vehicle_racer_health = 200;
+float autocvar_g_vehicle_racer_health_regen = 0;
+float autocvar_g_vehicle_racer_health_regen_pause = 0;
-float autocvar_g_vehicle_racer_shield;
-float autocvar_g_vehicle_racer_shield_regen;
-float autocvar_g_vehicle_racer_shield_regen_pause;
+float autocvar_g_vehicle_racer_shield = 100;
+float autocvar_g_vehicle_racer_shield_regen = 30;
+float autocvar_g_vehicle_racer_shield_regen_pause = 1;
-float autocvar_g_vehicle_racer_rocket_locktarget;
-float autocvar_g_vehicle_racer_rocket_locking_time;
-float autocvar_g_vehicle_racer_rocket_locking_releasetime;
-float autocvar_g_vehicle_racer_rocket_locked_time;
+bool autocvar_g_vehicle_racer_rocket_locktarget = true;
+float autocvar_g_vehicle_racer_rocket_locking_time = 0.9;
+float autocvar_g_vehicle_racer_rocket_locking_releasetime = 0.5;
+float autocvar_g_vehicle_racer_rocket_locked_time = 4;
-float autocvar_g_vehicle_racer_respawntime;
+float autocvar_g_vehicle_racer_respawntime = 35;
-float autocvar_g_vehicle_racer_blowup_radius;
-float autocvar_g_vehicle_racer_blowup_coredamage;
-float autocvar_g_vehicle_racer_blowup_edgedamage;
-float autocvar_g_vehicle_racer_blowup_forceintensity;
+float autocvar_g_vehicle_racer_blowup_radius = 250;
+float autocvar_g_vehicle_racer_blowup_coredamage = 250;
+float autocvar_g_vehicle_racer_blowup_edgedamage = 15;
+float autocvar_g_vehicle_racer_blowup_forceintensity = 250;
-float autocvar_g_vehicle_racer_bouncefactor;
-float autocvar_g_vehicle_racer_bouncestop;
-vector autocvar_g_vehicle_racer_bouncepain;
+// Factor of old velocity to keep after collision
+float autocvar_g_vehicle_racer_bouncefactor = 0.25;
+// if != 0, New veloctiy after bounce = 0 if new velocity < this
+float autocvar_g_vehicle_racer_bouncestop = 0;
+// "minspeed_for_pain speedchange_to_pain_factor max_damage"
+vector autocvar_g_vehicle_racer_bouncepain = '60 0.75 300';
.float racer_watertime;
racer_fire_rocket(player, v, v_forward, trg);
}
-float racer_frame()
-{SELFPARAM();
- entity player, racer;
- vector df;
- float ftmp;
+bool racer_frame(entity this)
+{
+ entity vehic = this.vehicle;
+ return = true;
if(intermission_running)
{
- self.vehicle.velocity = '0 0 0';
- self.vehicle.avelocity = '0 0 0';
- return 1;
+ vehic.velocity = '0 0 0';
+ vehic.avelocity = '0 0 0';
+ return;
}
- player = self;
- racer = self.vehicle;
- setself(racer);
-
- vehicles_frame(racer, player);
+ vehicles_frame(vehic, this);
- if(pointcontents(racer.origin) != CONTENT_WATER)
- racer.air_finished = time + autocvar_g_vehicle_racer_water_time;
+ if(pointcontents(vehic.origin) != CONTENT_WATER)
+ vehic.air_finished = time + autocvar_g_vehicle_racer_water_time;
- if(IS_DEAD(racer))
+ if(IS_DEAD(vehic))
{
- setself(player);
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ return;
}
- racer_align4point(self, PHYS_INPUT_TIMELENGTH);
+ racer_align4point(vehic, PHYS_INPUT_TIMELENGTH);
- PHYS_INPUT_BUTTON_ZOOM(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
+ PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
- crosshair_trace(player);
+ crosshair_trace(this);
- racer.angles_x *= -1;
+ vehic.angles_x *= -1;
// Yaw
- ftmp = autocvar_g_vehicle_racer_turnspeed * PHYS_INPUT_TIMELENGTH;
- ftmp = bound(-ftmp, shortangle_f(player.v_angle_y - racer.angles_y, racer.angles_y), ftmp);
- racer.angles_y = anglemods(racer.angles_y + ftmp);
+ float ftmp = autocvar_g_vehicle_racer_turnspeed * PHYS_INPUT_TIMELENGTH;
+ ftmp = bound(-ftmp, shortangle_f(this.v_angle_y - vehic.angles_y, vehic.angles_y), ftmp);
+ vehic.angles_y = anglemods(vehic.angles_y + ftmp);
// Roll
- racer.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * PHYS_INPUT_TIMELENGTH;
+ vehic.angles_z += -ftmp * autocvar_g_vehicle_racer_turnroll * PHYS_INPUT_TIMELENGTH;
// Pitch
ftmp = autocvar_g_vehicle_racer_pitchspeed * PHYS_INPUT_TIMELENGTH;
- ftmp = bound(-ftmp, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp);
- racer.angles_x = bound(-autocvar_g_vehicle_racer_pitchlimit, anglemods(racer.angles_x + ftmp), autocvar_g_vehicle_racer_pitchlimit);
+ ftmp = bound(-ftmp, shortangle_f(this.v_angle_x - vehic.angles_x, vehic.angles_x), ftmp);
+ vehic.angles_x = bound(-autocvar_g_vehicle_racer_pitchlimit, anglemods(vehic.angles_x + ftmp), autocvar_g_vehicle_racer_pitchlimit);
- makevectors(racer.angles);
- racer.angles_x *= -1;
+ makevectors(vehic.angles);
+ vehic.angles_x *= -1;
- //ftmp = racer.velocity_z;
- df = racer.velocity * -autocvar_g_vehicle_racer_friction;
- //racer.velocity_z = ftmp;
+ //ftmp = vehic.velocity_z;
+ vector df = vehic.velocity * -autocvar_g_vehicle_racer_friction;
+ //vehic.velocity_z = ftmp;
- int cont = pointcontents(racer.origin);
- if(player.movement)
+ int cont = pointcontents(vehic.origin);
+ if(this.movement)
{
if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
{
- if(player.movement_x) { df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
- if(player.movement_y) { df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
+ if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
+ if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
}
else
{
- if(player.movement_x) { df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
- if(player.movement_y) { df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
+ if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
+ if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
}
#ifdef SVQC
- if(self.sound_nexttime < time || self.sounds != 1)
+ if(vehic.sound_nexttime < time || vehic.sounds != 1)
{
- self.sounds = 1;
- self.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_RACER_MOVE, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.sounds = 1;
+ vehic.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RACER_MOVE, VOL_VEHICLEENGINE, ATTEN_NORM);
}
#endif
}
#ifdef SVQC
else
{
- if(self.sound_nexttime < time || self.sounds != 0)
+ if(vehic.sound_nexttime < time || vehic.sounds != 0)
{
- self.sounds = 0;
- self.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_RACER_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.sounds = 0;
+ vehic.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RACER_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
}
}
#endif
// Afterburn
- if (PHYS_INPUT_BUTTON_JUMP(player) && racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH))
+ if (PHYS_INPUT_BUTTON_JUMP(this) && vehic.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH))
{
#ifdef SVQC
- if(time - racer.wait > 0.2)
- pointparticles(EFFECT_RACER_BOOSTER, self.origin - v_forward * 32, v_forward * vlen(self.velocity), 1);
+ if(time - vehic.wait > 0.2)
+ pointparticles(EFFECT_RACER_BOOSTER, vehic.origin - v_forward * 32, v_forward * vlen(vehic.velocity), 1);
#endif
- racer.wait = time;
+ vehic.wait = time;
if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
{
- racer.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * PHYS_INPUT_TIMELENGTH;
+ vehic.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * PHYS_INPUT_TIMELENGTH;
df += (v_forward * autocvar_g_vehicle_racer_waterburn_speed);
}
else
{
- racer.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH;
+ vehic.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * PHYS_INPUT_TIMELENGTH;
df += (v_forward * autocvar_g_vehicle_racer_speed_afterburn);
}
#ifdef SVQC
- if(racer.invincible_finished < time)
+ if(vehic.invincible_finished < time)
{
- traceline(racer.origin, racer.origin - '0 0 256', MOVE_NORMAL, self);
+ traceline(vehic.origin, vehic.origin - '0 0 256', MOVE_NORMAL, vehic);
if(trace_fraction != 1.0)
pointparticles(EFFECT_SMOKE_SMALL, trace_endpos, '0 0 0', 1);
- racer.invincible_finished = time + 0.1 + (random() * 0.1);
+ vehic.invincible_finished = time + 0.1 + (random() * 0.1);
}
- if(racer.strength_finished < time)
+ if(vehic.strength_finished < time)
{
- racer.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
- sound (racer.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RACER_BOOST, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
+ sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RACER_BOOST, VOL_VEHICLEENGINE, ATTEN_NORM);
}
#endif
}
else
{
- racer.strength_finished = 0;
- sound (racer.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.strength_finished = 0;
+ sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM);
}
if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
- racer.racer_watertime = time;
+ vehic.racer_watertime = time;
float dforce = autocvar_g_vehicle_racer_downforce;
- if(time - racer.racer_watertime <= 3)
+ if(time - vehic.racer_watertime <= 3)
dforce = autocvar_g_vehicle_racer_water_downforce;
- df -= v_up * (vlen(racer.velocity) * dforce);
- player.movement = racer.velocity += df * PHYS_INPUT_TIMELENGTH;
+ df -= v_up * (vlen(vehic.velocity) * dforce);
+ this.movement = vehic.velocity += df * PHYS_INPUT_TIMELENGTH;
#ifdef SVQC
+ setself(vehic);
+
Weapon wep1 = WEP_RACER;
- if (!forbidWeaponUse(player))
- if (PHYS_INPUT_BUTTON_ATCK(player))
+ if (!forbidWeaponUse(this))
+ if (PHYS_INPUT_BUTTON_ATCK(this))
if (wep1.wr_checkammo1(wep1))
{
- string tagname = (racer.cnt)
- ? (racer.cnt = 0, "tag_fire1")
- : (racer.cnt = 1, "tag_fire2");
- vector org = gettaginfo(self, gettagindex(self, tagname));
+ string tagname = (vehic.cnt)
+ ? (vehic.cnt = 0, "tag_fire1")
+ : (vehic.cnt = 1, "tag_fire2");
+ vector org = gettaginfo(vehic, gettagindex(vehic, tagname));
w_shotorg = org;
w_shotdir = v_forward;
// Fix z-aim (for chase mode)
- crosshair_trace(player);
+ crosshair_trace(this);
w_shotdir.z = normalize(trace_endpos - org).z * 0.5;
.entity weaponentity = weaponentities[0];
- wep1.wr_think(wep1, self, weaponentity, 1);
+ wep1.wr_think(wep1, vehic, weaponentity, 1);
}
+ setself(this);
+
if(autocvar_g_vehicle_racer_rocket_locktarget)
{
- vehicles_locktarget(self, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
+ vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
(1 / autocvar_g_vehicle_racer_rocket_locking_releasetime) * frametime,
autocvar_g_vehicle_racer_rocket_locked_time);
- if(self.lock_target)
+ if(vehic.lock_target)
{
- if(racer.lock_strength == 1)
- UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '1 0 0', 0);
- else if(self.lock_strength > 0.5)
- UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '0 1 0', 0);
- else if(self.lock_strength < 0.5)
- UpdateAuxiliaryXhair(player, real_origin(self.lock_target), '0 0 1', 0);
+ if(vehic.lock_strength == 1)
+ UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 0);
+ else if(vehic.lock_strength > 0.5)
+ UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 0);
+ else if(vehic.lock_strength < 0.5)
+ UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 0);
}
}
- if(!forbidWeaponUse(player))
- if(time > racer.delay)
- if(PHYS_INPUT_BUTTON_ATCK2(player))
+ if(!forbidWeaponUse(this))
+ if(time > vehic.delay)
+ if(PHYS_INPUT_BUTTON_ATCK2(this))
{
- racer.misc_bulletcounter += 1;
- racer.delay = time + 0.3;
+ vehic.misc_bulletcounter += 1;
+ vehic.delay = time + 0.3;
- if(racer.misc_bulletcounter == 1)
+ if(vehic.misc_bulletcounter == 1)
{
- racer_fire_rocket_aim(player, "tag_rocket_r", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
- player.vehicle_ammo2 = 50;
+ racer_fire_rocket_aim(this, "tag_rocket_r", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : world);
+ this.vehicle_ammo2 = 50;
}
- else if(racer.misc_bulletcounter == 2)
+ else if(vehic.misc_bulletcounter == 2)
{
- racer_fire_rocket_aim(player, "tag_rocket_l", (racer.lock_strength == 1 && racer.lock_target) ? racer.lock_target : world);
- racer.lock_strength = 0;
- racer.lock_target = world;
- racer.misc_bulletcounter = 0;
- racer.delay = time + autocvar_g_vehicle_racer_rocket_refire;
- racer.lip = time;
- player.vehicle_ammo2 = 0;
+ racer_fire_rocket_aim(this, "tag_rocket_l", (vehic.lock_strength == 1 && vehic.lock_target) ? vehic.lock_target : world);
+ vehic.lock_strength = 0;
+ vehic.lock_target = world;
+ vehic.misc_bulletcounter = 0;
+ vehic.delay = time + autocvar_g_vehicle_racer_rocket_refire;
+ vehic.lip = time;
+ this.vehicle_ammo2 = 0;
}
}
- else if(racer.misc_bulletcounter == 0)
- player.vehicle_ammo2 = 100;
-
- player.vehicle_reload2 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
+ else if(vehic.misc_bulletcounter == 0)
+ this.vehicle_ammo2 = 100;
- if(racer.vehicle_flags & VHF_SHIELDREGEN)
- vehicles_regen(racer.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
+ this.vehicle_reload2 = bound(0, 100 * ((time - vehic.lip) / (vehic.delay - vehic.lip)), 100);
- if(racer.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(racer.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_SHIELDREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime, true);
- if(racer.vehicle_flags & VHF_ENERGYREGEN)
- vehicles_regen(racer.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_HEALTHREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_ENERGYREGEN)
+ vehicles_regen(vehic, vehic.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, frametime, false);
- VEHICLE_UPDATE_PLAYER(player, health, racer);
- VEHICLE_UPDATE_PLAYER(player, energy, racer);
+ VEHICLE_UPDATE_PLAYER(this, vehic, health, racer);
+ VEHICLE_UPDATE_PLAYER(this, vehic, energy, racer);
- if(racer.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(player, shield, racer);
+ if(vehic.vehicle_flags & VHF_HASSHIELD)
+ VEHICLE_UPDATE_PLAYER(this, vehic, shield, racer);
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
#endif
- setorigin(player,racer.origin + '0 0 32');
- player.velocity = racer.velocity;
-
- setself(player);
- return 1;
+ setorigin(this, vehic.origin + '0 0 32');
+ this.velocity = vehic.velocity;
}
void racer_think()
self.owner.oldvelocity = self.owner.velocity;
setorigin(self.owner , spot);
}
- antilag_clear(self.owner);
+ antilag_clear(self.owner, CS(self.owner));
self.owner = world;
}
spawnfunc(vehicle_racer)
{
- if(!autocvar_g_vehicle_racer) { remove(self); return; }
- if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_racer) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_RACER, false)) { remove(this); return; }
}
#endif // SVQC
{
#ifdef SVQC
if(autocvar_g_vehicle_racer_bouncepain)
- vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
#endif
}
METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
{
#ifdef SVQC
+ SELFPARAM();
self.movetype = MOVETYPE_BOUNCE;
self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health) * 100;
self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield) * 100;
if(self.owner.flagcarried)
setorigin(self.owner.flagcarried, '-190 0 96');
#elif defined(CSQC)
-
+ SELFPARAM();
self.move_movetype = MOVETYPE_BOUNCE;
#endif
}
METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
{
#ifdef SVQC
+ SELFPARAM();
if(self.scale != 0.5)
{
if(autocvar_g_vehicle_racer_hovertype != 0)
METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
{
#ifdef SVQC
- self.vehicle_exit = racer_exit;
-#endif
+ instance.vehicle_exit = racer_exit;
-#ifdef SVQC
// we have no need to network energy
if(autocvar_g_vehicle_racer_energy)
if(autocvar_g_vehicle_racer_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_racer_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_racer_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_racer_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.respawntime = autocvar_g_vehicle_racer_respawntime;
- self.vehicle_health = autocvar_g_vehicle_racer_health;
- self.vehicle_shield = autocvar_g_vehicle_racer_shield;
- self.max_health = self.vehicle_health;
+ instance.respawntime = autocvar_g_vehicle_racer_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_racer_health;
+ instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
+ instance.max_health = instance.vehicle_health;
#endif
#ifdef CSQC
-#ifndef VEHICLE_RACER_WEAPON_H
-#define VEHICLE_RACER_WEAPON_H
-
-#include <common/weapons/all.qh>
-
-CLASS(RacerAttack, PortoLaunch)
-/* flags */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RacerAttack, impulse, int, 3);
-/* refname */ ATTRIB(RacerAttack, netname, string, "racercannon");
-/* wepname */ ATTRIB(RacerAttack, m_name, string, _("Racer cannon"));
-ENDCLASS(RacerAttack)
-REGISTER_WEAPON(RACER, NEW(RacerAttack));
-
-// TODO: move into implementation
-#ifdef SVQC
-float autocvar_g_vehicle_racer_rocket_refire;
-void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
-#endif
-
-#endif
+#include "racer_weapon.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_racer_cannon_cost;
-float autocvar_g_vehicle_racer_cannon_damage;
-float autocvar_g_vehicle_racer_cannon_radius;
-float autocvar_g_vehicle_racer_cannon_refire;
-float autocvar_g_vehicle_racer_cannon_speed;
-float autocvar_g_vehicle_racer_cannon_spread;
-float autocvar_g_vehicle_racer_cannon_force;
-
-float autocvar_g_vehicle_racer_rocket_accel;
-float autocvar_g_vehicle_racer_rocket_damage;
-float autocvar_g_vehicle_racer_rocket_radius;
-float autocvar_g_vehicle_racer_rocket_force;
-float autocvar_g_vehicle_racer_rocket_speed;
-float autocvar_g_vehicle_racer_rocket_turnrate;
-
-float autocvar_g_vehicle_racer_rocket_climbspeed;
-float autocvar_g_vehicle_racer_rocket_locked_maxangle;
-
void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
veh.vehicle_energy -= autocvar_g_vehicle_racer_cannon_cost;
veh.wait = time;
}
- if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+ if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0);
vector org = w_shotorg;
vector dir = w_shotdir;
- entity bolt = vehicles_projectile(EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE),
+ entity bolt = vehicles_projectile(veh, EFFECT_RACER_MUZZLEFLASH.eent_eff_name, SND_LASERGUN_FIRE,
org, normalize(v_forward + randomvec() * autocvar_g_vehicle_racer_cannon_spread) * autocvar_g_vehicle_racer_cannon_speed,
autocvar_g_vehicle_racer_cannon_damage, autocvar_g_vehicle_racer_cannon_radius, autocvar_g_vehicle_racer_cannon_force, 0,
DEATH_VH_WAKI_GUN.m_id, PROJECTILE_WAKICANNON, 0, true, true, player);
}
if (fire & 2)
if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) {
- if (isPlayer) W_SetupShot_Dir(actor, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+ if (isPlayer) W_SetupShot_Dir(actor, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0);
racer_fire_rocket(player, w_shotorg, w_shotdir, NULL);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, 0, w_ready);
}
void racer_rocket_groundhugger();
void racer_fire_rocket(entity player, vector org, vector dir, entity trg)
-{SELFPARAM();
- entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+{
+ entity rocket = vehicles_projectile(player.vehicle, EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
org, dir * autocvar_g_vehicle_racer_rocket_speed,
autocvar_g_vehicle_racer_rocket_damage, autocvar_g_vehicle_racer_rocket_radius, autocvar_g_vehicle_racer_rocket_force, 3,
DEATH_VH_WAKI_ROCKET.m_id, PROJECTILE_WAKIROCKET, 20, false, false, player);
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+CLASS(RacerAttack, PortoLaunch)
+/* flags */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RacerAttack, impulse, int, 3);
+/* refname */ ATTRIB(RacerAttack, netname, string, "racercannon");
+/* wepname */ ATTRIB(RacerAttack, m_name, string, _("Racer cannon"));
+ENDCLASS(RacerAttack)
+REGISTER_WEAPON(RACER, NEW(RacerAttack));
+
+// TODO: move into implementation
+#ifdef SVQC
+void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
+#endif
+
+float autocvar_g_vehicle_racer_cannon_cost = 2;
+float autocvar_g_vehicle_racer_cannon_damage = 15;
+float autocvar_g_vehicle_racer_cannon_radius = 100;
+float autocvar_g_vehicle_racer_cannon_refire = 0.05;
+float autocvar_g_vehicle_racer_cannon_speed = 15000;
+float autocvar_g_vehicle_racer_cannon_spread = 0.0125;
+float autocvar_g_vehicle_racer_cannon_force = 50;
+
+float autocvar_g_vehicle_racer_rocket_accel = 1600;
+float autocvar_g_vehicle_racer_rocket_damage = 100;
+float autocvar_g_vehicle_racer_rocket_radius = 125;
+float autocvar_g_vehicle_racer_rocket_force = 350;
+float autocvar_g_vehicle_racer_rocket_speed = 900;
+float autocvar_g_vehicle_racer_rocket_turnrate = 0.2;
+float autocvar_g_vehicle_racer_rocket_refire = 3;
+
+float autocvar_g_vehicle_racer_rocket_climbspeed = 1600;
+float autocvar_g_vehicle_racer_rocket_locked_maxangle = 1.8;
#define VEHICLE_RAPTOR
#include "raptor.qh"
-#include "raptor_weapons.qc"
+#include "raptor_weapons.qh"
CLASS(Raptor, Vehicle)
/* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
#ifdef IMPLEMENTATION
-#include "raptor_weapons.qc"
-
#ifdef SVQC
-bool autocvar_g_vehicle_raptor;
+bool autocvar_g_vehicle_raptor = true;
-float autocvar_g_vehicle_raptor_respawntime;
-float autocvar_g_vehicle_raptor_takeofftime;
+float autocvar_g_vehicle_raptor_respawntime = 40;
+float autocvar_g_vehicle_raptor_takeofftime = 1.5;
-float autocvar_g_vehicle_raptor_movestyle;
-float autocvar_g_vehicle_raptor_turnspeed;
-float autocvar_g_vehicle_raptor_pitchspeed;
-float autocvar_g_vehicle_raptor_pitchlimit;
+// 0: go where player aims, +forward etc relative to aim angles
+// 1: ignore aim for up/down movement. +forward always moved forward, +jump always moves up
+int autocvar_g_vehicle_raptor_movestyle = 1;
+float autocvar_g_vehicle_raptor_turnspeed = 200;
+float autocvar_g_vehicle_raptor_pitchspeed = 50;
+float autocvar_g_vehicle_raptor_pitchlimit = 45;
-float autocvar_g_vehicle_raptor_speed_forward;
-float autocvar_g_vehicle_raptor_speed_strafe;
-float autocvar_g_vehicle_raptor_speed_up;
-float autocvar_g_vehicle_raptor_speed_down;
-float autocvar_g_vehicle_raptor_friction;
+float autocvar_g_vehicle_raptor_speed_forward = 1700;
+float autocvar_g_vehicle_raptor_speed_strafe = 900;
+float autocvar_g_vehicle_raptor_speed_up = 1700;
+float autocvar_g_vehicle_raptor_speed_down = 1700;
+float autocvar_g_vehicle_raptor_friction = 2;
-float autocvar_g_vehicle_raptor_cannon_turnspeed;
-float autocvar_g_vehicle_raptor_cannon_turnlimit;
-float autocvar_g_vehicle_raptor_cannon_pitchlimit_up;
-float autocvar_g_vehicle_raptor_cannon_pitchlimit_down;
+float autocvar_g_vehicle_raptor_cannon_turnspeed = 120;
+float autocvar_g_vehicle_raptor_cannon_turnlimit = 20;
+float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12;
+float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32;
-float autocvar_g_vehicle_raptor_cannon_locktarget;
-float autocvar_g_vehicle_raptor_cannon_locking_time;
-float autocvar_g_vehicle_raptor_cannon_locking_releasetime;
-float autocvar_g_vehicle_raptor_cannon_locked_time;
-float autocvar_g_vehicle_raptor_cannon_predicttarget;
+float autocvar_g_vehicle_raptor_cannon_locktarget = 0;
+float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2;
+float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45;
+float autocvar_g_vehicle_raptor_cannon_locked_time = 1;
+float autocvar_g_vehicle_raptor_cannon_predicttarget = 1;
-float autocvar_g_vehicle_raptor_energy;
-float autocvar_g_vehicle_raptor_energy_regen;
-float autocvar_g_vehicle_raptor_energy_regen_pause;
+float autocvar_g_vehicle_raptor_energy = 100;
+float autocvar_g_vehicle_raptor_energy_regen = 25;
+float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25;
-float autocvar_g_vehicle_raptor_health;
-float autocvar_g_vehicle_raptor_health_regen;
-float autocvar_g_vehicle_raptor_health_regen_pause;
+float autocvar_g_vehicle_raptor_health = 150;
+float autocvar_g_vehicle_raptor_health_regen = 0;
+float autocvar_g_vehicle_raptor_health_regen_pause = 0;
-float autocvar_g_vehicle_raptor_shield;
-float autocvar_g_vehicle_raptor_shield_regen;
-float autocvar_g_vehicle_raptor_shield_regen_pause;
+float autocvar_g_vehicle_raptor_shield = 75;
+float autocvar_g_vehicle_raptor_shield_regen = 25;
+float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5;
-float autocvar_g_vehicle_raptor_bouncefactor;
-float autocvar_g_vehicle_raptor_bouncestop;
-vector autocvar_g_vehicle_raptor_bouncepain;
+float autocvar_g_vehicle_raptor_bouncefactor = 0.2;
+float autocvar_g_vehicle_raptor_bouncestop = 0;
+vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000';
.entity bomb1;
.entity bomb2;
setorigin(self.owner , spot);
}
- antilag_clear(self.owner);
+ antilag_clear(self.owner, CS(self.owner));
self.owner = world;
}
-float raptor_frame()
-{SELFPARAM();
- entity player, raptor;
- float ftmp = 0;
- vector df;
+bool raptor_frame(entity this)
+{
+ entity vehic = this.vehicle;
+ return = true;
if(intermission_running)
{
- self.vehicle.velocity = '0 0 0';
- self.vehicle.avelocity = '0 0 0';
- return 1;
+ vehic.velocity = '0 0 0';
+ vehic.avelocity = '0 0 0';
+ return;
}
- player = self;
- raptor = self.vehicle;
- setself(raptor);
-
- vehicles_frame(raptor, player);
+ vehicles_frame(vehic, this);
+ float ftmp = 0;
/*
- ftmp = vlen(self.velocity);
+ ftmp = vlen(vehic.velocity);
if(ftmp > autocvar_g_vehicle_raptor_speed_forward)
ftmp = 1;
else
ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward;
*/
- if(self.sound_nexttime < time)
+ if(vehic.sound_nexttime < time)
{
- self.sound_nexttime = time + 7.955812;
- //sound (self.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
- self.wait = ftmp;
+ vehic.sound_nexttime = time + 7.955812;
+ //sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_FLY, 1 - ftmp, ATTEN_NORM );
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, 1, ATTEN_NORM);
+ vehic.wait = ftmp;
}
/*
- else if(fabs(ftmp - self.wait) > 0.2)
+ else if(fabs(ftmp - vehic.wait) > 0.2)
{
- sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
- sound (self, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
- self.wait = ftmp;
+ sound (vehic.tur_head, CH_TRIGGER_SINGLE, SND_Null, 1 - ftmp, ATTEN_NORM );
+ sound (vehic, CH_TRIGGER_SINGLE, SND_Null, ftmp, ATTEN_NORM);
+ vehic.wait = ftmp;
}
*/
- if(IS_DEAD(raptor))
+ if(IS_DEAD(vehic))
{
- setself(player);
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ return;
}
- crosshair_trace(player);
+ crosshair_trace(this);
- //if(time - self.lastteleporttime < 1)
+ //if(time - vehic.lastteleporttime < 1)
//{
- if(raptor.angles_z > 50 || raptor.angles_z < -50)
+ if(vehic.angles_z > 50 || vehic.angles_z < -50)
{
- if(PHYS_INPUT_BUTTON_JUMP(player))
+ if(PHYS_INPUT_BUTTON_JUMP(this))
{
- PHYS_INPUT_BUTTON_CROUCH(player) = true;
- PHYS_INPUT_BUTTON_JUMP(player) = false;
+ PHYS_INPUT_BUTTON_CROUCH(this) = true;
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
}
}
//}
vector vang;
- vang = raptor.angles;
- df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
+ vang = vehic.angles;
+ vector df = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
vang_x *= -1;
df_x *= -1;
if(df_x > 180) df_x -= 360;
if(df_y > 180) df_y -= 360;
if(df_y < -180) df_y += 360;
- ftmp = shortangle_f(player.v_angle_y - vang_y, vang_y);
+ ftmp = shortangle_f(this.v_angle_y - vang_y, vang_y);
if(ftmp > 180) ftmp -= 360; if(ftmp < -180) ftmp += 360;
- raptor.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + raptor.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
+ vehic.avelocity_y = bound(-autocvar_g_vehicle_raptor_turnspeed, ftmp + vehic.avelocity_y * 0.9, autocvar_g_vehicle_raptor_turnspeed);
// Pitch
ftmp = 0;
- if(player.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
- else if(player.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
+ if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
+ else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
- raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + raptor.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
+ vehic.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchspeed, ftmp + vehic.avelocity_x * 0.9, autocvar_g_vehicle_raptor_pitchspeed);
- raptor.angles_x = anglemods(raptor.angles_x);
- raptor.angles_y = anglemods(raptor.angles_y);
- raptor.angles_z = anglemods(raptor.angles_z);
+ vehic.angles_x = anglemods(vehic.angles_x);
+ vehic.angles_y = anglemods(vehic.angles_y);
+ vehic.angles_z = anglemods(vehic.angles_z);
if(autocvar_g_vehicle_raptor_movestyle == 1)
- makevectors('0 1 0' * raptor.angles_y);
+ makevectors('0 1 0' * vehic.angles_y);
else
- makevectors(player.v_angle);
+ makevectors(this.v_angle);
- df = raptor.velocity * -autocvar_g_vehicle_raptor_friction;
+ df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
- if(player.movement_x != 0)
+ if(this.movement_x != 0)
{
- if(player.movement_x > 0)
+ if(this.movement_x > 0)
df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
- else if(player.movement_x < 0)
+ else if(this.movement_x < 0)
df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
}
- if(player.movement_y != 0)
+ if(this.movement_y != 0)
{
- if(player.movement_y < 0)
+ if(this.movement_y < 0)
df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
- else if(player.movement_y > 0)
+ else if(this.movement_y > 0)
df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
- raptor.angles_z = bound(-30,raptor.angles_z + (player.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
+ vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
}
else
{
- raptor.angles_z *= 0.95;
- if(raptor.angles_z >= -1 && raptor.angles_z <= -1)
- raptor.angles_z = 0;
+ vehic.angles_z *= 0.95;
+ if(vehic.angles_z >= -1 && vehic.angles_z <= -1)
+ vehic.angles_z = 0;
}
- if(PHYS_INPUT_BUTTON_CROUCH(player))
+ if(PHYS_INPUT_BUTTON_CROUCH(this))
df -= v_up * autocvar_g_vehicle_raptor_speed_down;
- else if (PHYS_INPUT_BUTTON_JUMP(player))
+ else if (PHYS_INPUT_BUTTON_JUMP(this))
df += v_up * autocvar_g_vehicle_raptor_speed_up;
- raptor.velocity += df * frametime;
- player.velocity = player.movement = raptor.velocity;
- setorigin(player, raptor.origin + '0 0 32');
+ vehic.velocity += df * frametime;
+ this.velocity = this.movement = vehic.velocity;
+ setorigin(this, vehic.origin + '0 0 32');
- player.vehicle_weapon2mode = raptor.vehicle_weapon2mode;
+ this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
vector vf, ad;
// Target lock & predict
if(autocvar_g_vehicle_raptor_cannon_locktarget == 2)
{
- if(raptor.gun1.lock_time < time || IS_DEAD(raptor.gun1.enemy) || STAT(FROZEN, raptor.gun1.enemy))
- raptor.gun1.enemy = world;
+ if(vehic.gun1.lock_time < time || IS_DEAD(vehic.gun1.enemy) || STAT(FROZEN, vehic.gun1.enemy))
+ vehic.gun1.enemy = world;
if(trace_ent)
if(trace_ent.movetype)
{
if(teamplay)
{
- if(trace_ent.team != player.team)
+ if(trace_ent.team != this.team)
{
- raptor.gun1.enemy = trace_ent;
- raptor.gun1.lock_time = time + 5;
+ vehic.gun1.enemy = trace_ent;
+ vehic.gun1.lock_time = time + 5;
}
}
else
{
- raptor.gun1.enemy = trace_ent;
- raptor.gun1.lock_time = time + 0.5;
+ vehic.gun1.enemy = trace_ent;
+ vehic.gun1.lock_time = time + 0.5;
}
}
- if(raptor.gun1.enemy)
+ if(vehic.gun1.enemy)
{
float distance, impact_time;
- vf = real_origin(raptor.gun1.enemy);
- UpdateAuxiliaryXhair(player, vf, '1 0 0', 1);
- vector _vel = raptor.gun1.enemy.velocity;
- if(raptor.gun1.enemy.movetype == MOVETYPE_WALK)
+ vf = real_origin(vehic.gun1.enemy);
+ UpdateAuxiliaryXhair(this, vf, '1 0 0', 1);
+ vector _vel = vehic.gun1.enemy.velocity;
+ if(vehic.gun1.enemy.movetype == MOVETYPE_WALK)
_vel_z *= 0.1;
if(autocvar_g_vehicle_raptor_cannon_predicttarget)
{
ad = vf;
- distance = vlen(ad - player.origin);
+ distance = vlen(ad - this.origin);
impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
ad = vf + _vel * impact_time;
trace_endpos = ad;
else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1)
{
- vehicles_locktarget(self, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
+ vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime,
(1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime,
autocvar_g_vehicle_raptor_cannon_locked_time);
- if(self.lock_target != world)
+ if(vehic.lock_target != world)
if(autocvar_g_vehicle_raptor_cannon_predicttarget)
- if(self.lock_strength == 1)
+ if(vehic.lock_strength == 1)
{
float i, distance, impact_time;
- vf = real_origin(raptor.lock_target);
+ vf = real_origin(vehic.lock_target);
ad = vf;
for(i = 0; i < 4; ++i)
{
- distance = vlen(ad - raptor.origin);
+ distance = vlen(ad - vehic.origin);
impact_time = distance / autocvar_g_vehicle_raptor_cannon_speed;
- ad = vf + raptor.lock_target.velocity * impact_time;
+ ad = vf + vehic.lock_target.velocity * impact_time;
}
trace_endpos = ad;
}
- if(self.lock_target)
+ if(vehic.lock_target)
{
- if(raptor.lock_strength == 1)
- UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '1 0 0', 1);
- else if(self.lock_strength > 0.5)
- UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '0 1 0', 1);
- else if(self.lock_strength < 0.5)
- UpdateAuxiliaryXhair(player, real_origin(raptor.lock_target), '0 0 1', 1);
+ if(vehic.lock_strength == 1)
+ UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '1 0 0', 1);
+ else if(vehic.lock_strength > 0.5)
+ UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 1 0', 1);
+ else if(vehic.lock_strength < 0.5)
+ UpdateAuxiliaryXhair(this, real_origin(vehic.lock_target), '0 0 1', 1);
}
}
- vehicle_aimturret(raptor, trace_endpos, raptor.gun1, "fire1",
+ vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1",
autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
- vehicle_aimturret(raptor, trace_endpos, raptor.gun2, "fire1",
+ vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1",
autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up,
autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed);
/*
ad = ad * 0.5;
v_forward = vf * 0.5;
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, raptor);
- UpdateAuxiliaryXhair(player, trace_endpos, '0 1 0', 0);
+ traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
*/
+ // TODO: fix wr_checkammo and its use of self!
+ setself(vehic);
+
Weapon wep1 = WEP_RAPTOR;
- if(!forbidWeaponUse(player))
- if(PHYS_INPUT_BUTTON_ATCK(player))
+ if(!forbidWeaponUse(this))
+ if(PHYS_INPUT_BUTTON_ATCK(this))
if (wep1.wr_checkammo1(wep1))
{
.entity weaponentity = weaponentities[0];
- wep1.wr_think(wep1, self, weaponentity, 1);
+ wep1.wr_think(wep1, vehic, weaponentity, 1);
}
- if(self.vehicle_flags & VHF_SHIELDREGEN)
- vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
+ if(vehic.vehicle_flags & VHF_SHIELDREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
- if(self.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_HEALTHREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
- if(self.vehicle_flags & VHF_ENERGYREGEN)
- vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_ENERGYREGEN)
+ vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
Weapon wep2a = WEP_RAPTOR_BOMB;
- if(!forbidWeaponUse(player))
- if(raptor.vehicle_weapon2mode == RSM_BOMB)
+ if(!forbidWeaponUse(this))
+ if(vehic.vehicle_weapon2mode == RSM_BOMB)
{
- if(time > raptor.lip + autocvar_g_vehicle_raptor_bombs_refire)
- if(PHYS_INPUT_BUTTON_ATCK2(player))
+ if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire)
+ if(PHYS_INPUT_BUTTON_ATCK2(this))
{
.entity weaponentity = weaponentities[1];
- wep2a.wr_think(wep2a, self, weaponentity, 2);
- raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
- raptor.lip = time;
+ wep2a.wr_think(wep2a, vehic, weaponentity, 2);
+ vehic.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
+ vehic.lip = time;
}
}
else
{
Weapon wep2b = WEP_RAPTOR_FLARE;
- if(time > raptor.lip + autocvar_g_vehicle_raptor_flare_refire)
- if(PHYS_INPUT_BUTTON_ATCK2(player))
+ if(time > vehic.lip + autocvar_g_vehicle_raptor_flare_refire)
+ if(PHYS_INPUT_BUTTON_ATCK2(this))
{
.entity weaponentity = weaponentities[1];
- wep2b.wr_think(wep2b, self, weaponentity, 2);
- raptor.delay = time + autocvar_g_vehicle_raptor_flare_refire;
- raptor.lip = time;
+ wep2b.wr_think(wep2b, vehic, weaponentity, 2);
+ vehic.delay = time + autocvar_g_vehicle_raptor_flare_refire;
+ vehic.lip = time;
}
}
- raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
- player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
- player.vehicle_ammo2 = (player.vehicle_reload2 == 100) ? 100 : 0;
+ setself(this);
- if(self.bomb1.cnt < time)
+ vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
+ this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
+ this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
+
+ if(vehic.bomb1.cnt < time)
{
- entity _missile = findchainentity(enemy, raptor);
- float _incomming = 0;
- while(_missile)
+ bool incoming = false;
+ FOREACH_ENTITY_ENT(enemy, vehic,
{
- if(_missile.flags & FL_PROJECTILE)
- if(MISSILE_IS_TRACKING(_missile))
- if(vdist(self.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
- ++_incomming;
+ if(it.flags & FL_PROJECTILE)
+ if(MISSILE_IS_TRACKING(it))
+ if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
+ {
+ incoming = true;
+ break;
+ }
+ });
- _missile = _missile.chain;
+ if(incoming)
+ {
+ msg_entity = this;
+ soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
}
- if(_incomming)
- sound(self, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE);
-
- self.bomb1.cnt = time + 1;
+ vehic.bomb1.cnt = time + 1;
}
- VEHICLE_UPDATE_PLAYER(player, health, raptor);
- VEHICLE_UPDATE_PLAYER(player, energy, raptor);
- if(self.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(player, shield, raptor);
+ VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
+ VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
+ if(vehic.vehicle_flags & VHF_HASSHIELD)
+ VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
-
- setself(player);
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
-float raptor_takeoff()
-{SELFPARAM();
- entity player, raptor;
-
- player = self;
- raptor = self.vehicle;
- setself(raptor);
+bool raptor_takeoff(entity this)
+{
+ entity vehic = this.vehicle;
+ return = true;
- self.nextthink = time;
- CSQCMODEL_AUTOUPDATE(self);
- self.nextthink = 0; // will this work?
+ vehic.nextthink = time;
+ CSQCMODEL_AUTOUPDATE(vehic);
+ vehic.nextthink = 0; // will this work?
- if(self.sound_nexttime < time)
+ if(vehic.sound_nexttime < time)
{
- self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_RAPTOR_SPEED, VOL_VEHICLEENGINE, ATTEN_NORM);
}
// Takeoff sequense
- if(raptor.frame < 25)
+ if(vehic.frame < 25)
{
- raptor.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
- raptor.velocity_z = min(raptor.velocity_z * 1.5, 256);
- self.bomb1.gun1.avelocity_y = 90 + ((raptor.frame / 25) * 25000);
- self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y;
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
+ vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime);
+ vehic.velocity_z = min(vehic.velocity_z * 1.5, 256);
+ vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000);
+ vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
- setorigin(player, raptor.origin + '0 0 32');
+ setorigin(this, vehic.origin + '0 0 32');
}
else
- player.PlayerPhysplug = raptor_frame;
+ this.PlayerPhysplug = raptor_frame;
- if(self.vehicle_flags & VHF_SHIELDREGEN)
- vehicles_regen(raptor.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
+ if(vehic.vehicle_flags & VHF_SHIELDREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true);
- if(self.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(raptor.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_HEALTHREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false);
- if(self.vehicle_flags & VHF_ENERGYREGEN)
- vehicles_regen(raptor.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_ENERGYREGEN)
+ vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false);
- raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
- player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
- player.vehicle_ammo2 = (player.vehicle_reload2 == 100) ? 100 : 0;
+ vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
+ this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
+ this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
- VEHICLE_UPDATE_PLAYER(player, health, raptor);
- VEHICLE_UPDATE_PLAYER(player, energy, raptor);
- if(self.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(player, shield, raptor);
+ VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor);
+ VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
+ if(vehic.vehicle_flags & VHF_HASSHIELD)
+ VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = PHYS_INPUT_BUTTON_CROUCH(player) = false;
- setself(player);
- return 1;
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
}
void raptor_blowup()
spawnfunc(vehicle_raptor)
{
- if(!autocvar_g_vehicle_raptor) { remove(self); return; }
- if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_raptor) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
}
METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
{
if(autocvar_g_vehicle_raptor_bouncepain)
- vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
}
METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
{
+ SELFPARAM();
self.vehicle_weapon2mode = RSM_BOMB;
self.owner.PlayerPhysplug = raptor_takeoff;
self.movetype = MOVETYPE_BOUNCEMISSILE;
}
METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
{
+ SELFPARAM();
if(!self.gun1)
{
entity spinner;
METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
{
if(autocvar_g_vehicle_raptor_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_raptor_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_raptor_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
if(autocvar_g_vehicle_raptor_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
- self.vehicle_exit = raptor_exit;
- self.respawntime = autocvar_g_vehicle_raptor_respawntime;
- self.vehicle_health = autocvar_g_vehicle_raptor_health;
- self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
- self.max_health = self.vehicle_health;
+ instance.vehicle_exit = raptor_exit;
+ instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+ instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+ instance.max_health = instance.vehicle_health;
}
#endif
}
METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
{
+ SELFPARAM();
string crosshair;
switch(weapon2mode)
-#ifndef VEHICLE_RAPTOR_WEAPONS_H
-#define VEHICLE_RAPTOR_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-CLASS(RaptorCannon, PortoLaunch)
-/* flags */ ATTRIB(RaptorCannon, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RaptorCannon, impulse, int, 3);
-/* refname */ ATTRIB(RaptorCannon, netname, string, "raptorcannon");
-/* wepname */ ATTRIB(RaptorCannon, m_name, string, _("Raptor cannon"));
-ENDCLASS(RaptorCannon)
-REGISTER_WEAPON(RAPTOR, NEW(RaptorCannon));
-
-CLASS(RaptorBomb, PortoLaunch)
-/* flags */ ATTRIB(RaptorBomb, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RaptorBomb, impulse, int, 3);
-/* refname */ ATTRIB(RaptorBomb, netname, string, "raptorbomb");
-/* wepname */ ATTRIB(RaptorBomb, m_name, string, _("Raptor bomb"));
-ENDCLASS(RaptorBomb)
-REGISTER_WEAPON(RAPTOR_BOMB, NEW(RaptorBomb));
-
-CLASS(RaptorFlare, PortoLaunch)
-/* flags */ ATTRIB(RaptorFlare, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RaptorFlare, impulse, int, 3);
-/* refname */ ATTRIB(RaptorFlare, netname, string, "raptorflare");
-/* wepname */ ATTRIB(RaptorFlare, m_name, string, _("Raptor flare"));
-ENDCLASS(RaptorFlare)
-REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
-
-#endif
+#include "raptor_weapons.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_raptor_cannon_cost;
-float autocvar_g_vehicle_raptor_cannon_damage;
-float autocvar_g_vehicle_raptor_cannon_radius;
-float autocvar_g_vehicle_raptor_cannon_refire;
-float autocvar_g_vehicle_raptor_cannon_speed;
-float autocvar_g_vehicle_raptor_cannon_spread;
-float autocvar_g_vehicle_raptor_cannon_force;
-
-float autocvar_g_vehicle_raptor_bomblets;
-float autocvar_g_vehicle_raptor_bomblet_alt;
-float autocvar_g_vehicle_raptor_bomblet_time;
-float autocvar_g_vehicle_raptor_bomblet_damage;
-float autocvar_g_vehicle_raptor_bomblet_spread;
-float autocvar_g_vehicle_raptor_bomblet_edgedamage;
-float autocvar_g_vehicle_raptor_bomblet_radius;
-float autocvar_g_vehicle_raptor_bomblet_force;
-float autocvar_g_vehicle_raptor_bomblet_explode_delay;
-
METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
bool isPlayer = IS_PLAYER(actor);
entity player = isPlayer ? actor : actor.owner;
float t = autocvar_g_vehicle_raptor_cannon_refire * (1 + veh.misc_bulletcounter == 4);
if (fire & 1)
if (weapon_prepareattack(thiswep, player, weaponentity, false, t)) {
- if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND(Null), CH_WEAPON_B, 0);
+ if (isPlayer) W_SetupShot_Dir(player, v_forward, false, 0, SND_Null, CH_WEAPON_B, 0);
vector org = w_shotorg;
vector dir = w_shotdir;
if (veh) {
veh.vehicle_energy -= autocvar_g_vehicle_raptor_cannon_cost;
actor.cnt = time;
}
- vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND(LASERGUN_FIRE),
+ vehicles_projectile(veh, EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, SND_LASERGUN_FIRE,
org, normalize(dir + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0,
DEATH_VH_RAPT_CANNON.m_id, PROJECTILE_RAPTORCANNON, 0, true, true, player);
return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_raptor_cannon_cost;
}
-float autocvar_g_vehicle_raptor_bombs_refire;
void raptor_bombdrop();
METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
}
}
-float autocvar_g_vehicle_raptor_flare_refire;
-float autocvar_g_vehicle_raptor_flare_lifetime;
-float autocvar_g_vehicle_raptor_flare_chase;
-float autocvar_g_vehicle_raptor_flare_range;
-
void raptor_flare_think();
void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
void raptor_flare_touch();
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+CLASS(RaptorCannon, PortoLaunch)
+/* flags */ ATTRIB(RaptorCannon, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RaptorCannon, impulse, int, 3);
+/* refname */ ATTRIB(RaptorCannon, netname, string, "raptorcannon");
+/* wepname */ ATTRIB(RaptorCannon, m_name, string, _("Raptor cannon"));
+ENDCLASS(RaptorCannon)
+REGISTER_WEAPON(RAPTOR, NEW(RaptorCannon));
+
+CLASS(RaptorBomb, PortoLaunch)
+/* flags */ ATTRIB(RaptorBomb, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RaptorBomb, impulse, int, 3);
+/* refname */ ATTRIB(RaptorBomb, netname, string, "raptorbomb");
+/* wepname */ ATTRIB(RaptorBomb, m_name, string, _("Raptor bomb"));
+ENDCLASS(RaptorBomb)
+REGISTER_WEAPON(RAPTOR_BOMB, NEW(RaptorBomb));
+
+CLASS(RaptorFlare, PortoLaunch)
+/* flags */ ATTRIB(RaptorFlare, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RaptorFlare, impulse, int, 3);
+/* refname */ ATTRIB(RaptorFlare, netname, string, "raptorflare");
+/* wepname */ ATTRIB(RaptorFlare, m_name, string, _("Raptor flare"));
+ENDCLASS(RaptorFlare)
+REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
+
+
+float autocvar_g_vehicle_raptor_cannon_cost = 1;
+float autocvar_g_vehicle_raptor_cannon_damage = 10;
+float autocvar_g_vehicle_raptor_cannon_radius = 60;
+float autocvar_g_vehicle_raptor_cannon_refire = 0.03;
+float autocvar_g_vehicle_raptor_cannon_speed = 24000;
+float autocvar_g_vehicle_raptor_cannon_spread = 0.01;
+float autocvar_g_vehicle_raptor_cannon_force = 25;
+
+float autocvar_g_vehicle_raptor_bomblets = 8;
+float autocvar_g_vehicle_raptor_bomblet_alt = 750;
+float autocvar_g_vehicle_raptor_bomblet_time = 0.5;
+float autocvar_g_vehicle_raptor_bomblet_damage = 55;
+float autocvar_g_vehicle_raptor_bomblet_spread = 0.4;
+float autocvar_g_vehicle_raptor_bomblet_edgedamage = 25;
+float autocvar_g_vehicle_raptor_bomblet_radius = 350;
+float autocvar_g_vehicle_raptor_bomblet_force = 150;
+float autocvar_g_vehicle_raptor_bomblet_explode_delay = 0.4;
+
+float autocvar_g_vehicle_raptor_bombs_refire = 5;
+
+float autocvar_g_vehicle_raptor_flare_refire = 5;
+float autocvar_g_vehicle_raptor_flare_lifetime = 10;
+float autocvar_g_vehicle_raptor_flare_chase = 0.9;
+float autocvar_g_vehicle_raptor_flare_range = 2000;
#ifndef VEHICLE_SPIDERBOT
#define VEHICLE_SPIDERBOT
-#include "spiderbot_weapons.qc"
+#include "spiderbot_weapons.qh"
CLASS(Spiderbot, Vehicle)
/* spawnflags */ ATTRIB(Spiderbot, spawnflags, int, VHF_DMGSHAKE);
const int SBRM_ARTILLERY = 3;
const int SBRM_LAST = 3;
-#include "spiderbot_weapons.qc"
-
#ifdef SVQC
-bool autocvar_g_vehicle_spiderbot;
+bool autocvar_g_vehicle_spiderbot = true;
-float autocvar_g_vehicle_spiderbot_respawntime;
+float autocvar_g_vehicle_spiderbot_respawntime = 45;
-float autocvar_g_vehicle_spiderbot_speed_stop;
-float autocvar_g_vehicle_spiderbot_speed_strafe;
-float autocvar_g_vehicle_spiderbot_speed_walk;
+float autocvar_g_vehicle_spiderbot_speed_stop = 50;
+float autocvar_g_vehicle_spiderbot_speed_strafe = 400;
+float autocvar_g_vehicle_spiderbot_speed_walk = 500;
float autocvar_g_vehicle_spiderbot_speed_run = 700;
-float autocvar_g_vehicle_spiderbot_turnspeed;
-float autocvar_g_vehicle_spiderbot_turnspeed_strafe;
-float autocvar_g_vehicle_spiderbot_movement_inertia;
+float autocvar_g_vehicle_spiderbot_turnspeed = 90;
+float autocvar_g_vehicle_spiderbot_turnspeed_strafe = 300;
+float autocvar_g_vehicle_spiderbot_movement_inertia = 0.15;
-float autocvar_g_vehicle_spiderbot_springlength;
-float autocvar_g_vehicle_spiderbot_springup;
-float autocvar_g_vehicle_spiderbot_springblend;
-float autocvar_g_vehicle_spiderbot_tiltlimit;
+float autocvar_g_vehicle_spiderbot_springlength = 150;
+float autocvar_g_vehicle_spiderbot_springup = 20;
+float autocvar_g_vehicle_spiderbot_springblend = 0.1;
+float autocvar_g_vehicle_spiderbot_tiltlimit = 90;
-float autocvar_g_vehicle_spiderbot_head_pitchlimit_down;
-float autocvar_g_vehicle_spiderbot_head_pitchlimit_up;
-float autocvar_g_vehicle_spiderbot_head_turnlimit;
-float autocvar_g_vehicle_spiderbot_head_turnspeed;
+float autocvar_g_vehicle_spiderbot_head_pitchlimit_down = -20;
+float autocvar_g_vehicle_spiderbot_head_pitchlimit_up = 30;
+float autocvar_g_vehicle_spiderbot_head_turnlimit = 90;
+float autocvar_g_vehicle_spiderbot_head_turnspeed = 110;
-int autocvar_g_vehicle_spiderbot_health;
-float autocvar_g_vehicle_spiderbot_health_regen;
-float autocvar_g_vehicle_spiderbot_health_regen_pause;
+int autocvar_g_vehicle_spiderbot_health = 800;
+float autocvar_g_vehicle_spiderbot_health_regen = 10;
+float autocvar_g_vehicle_spiderbot_health_regen_pause = 5;
-int autocvar_g_vehicle_spiderbot_shield;
-float autocvar_g_vehicle_spiderbot_shield_regen;
-float autocvar_g_vehicle_spiderbot_shield_regen_pause;
+int autocvar_g_vehicle_spiderbot_shield = 200;
+float autocvar_g_vehicle_spiderbot_shield_regen = 25;
+float autocvar_g_vehicle_spiderbot_shield_regen_pause = 0.35;
-vector autocvar_g_vehicle_spiderbot_bouncepain;
+// 'minspeed_for_pain speedchange_to_pain_factor max_damage'
+vector autocvar_g_vehicle_spiderbot_bouncepain = '0 0 0';
.float jump_delay;
-float spiderbot_frame()
-{SELFPARAM();
- vector ad, vf;
- entity player, spider;
- float ftmp;
+bool spiderbot_frame(entity this)
+{
+ entity vehic = this.vehicle;
+ return = true;
if(intermission_running)
{
- self.vehicle.velocity = '0 0 0';
- self.vehicle.avelocity = '0 0 0';
- return 1;
+ vehic.velocity = '0 0 0';
+ vehic.avelocity = '0 0 0';
+ return;
}
- player = self;
- spider = self.vehicle;
-
- vehicles_frame(spider, player);
-
- setself(spider);
+ vehicles_frame(vehic, this);
- PHYS_INPUT_BUTTON_ZOOM(player) = false;
- PHYS_INPUT_BUTTON_CROUCH(player) = false;
- PS(player).m_switchweapon = WEP_Null;
- player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
+ PHYS_INPUT_BUTTON_ZOOM(this) = false;
+ PHYS_INPUT_BUTTON_CROUCH(this) = false;
+ PS(this).m_switchweapon = WEP_Null;
+ this.vehicle_weapon2mode = vehic.vehicle_weapon2mode;
#if 1 // 0 to enable per-gun impact aux crosshairs
// Avarage gun impact point's -> aux cross
- ad = gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint01"));
- vf = v_forward;
- ad += gettaginfo(spider.tur_head, gettagindex(spider.tur_head, "tag_hardpoint02"));
+ vector ad = gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint01"));
+ vector vf = v_forward;
+ ad += gettaginfo(vehic.tur_head, gettagindex(vehic.tur_head, "tag_hardpoint02"));
vf += v_forward;
ad = ad * 0.5;
v_forward = vf * 0.5;
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
- UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
+ traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
#else
- ad = gettaginfo(spider.gun1, gettagindex(spider.gun1, "barrels"));
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
- UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 0);
- vf = ad;
- ad = gettaginfo(spider.gun2, gettagindex(spider.gun2, "barrels"));
- traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, spider);
- UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload1) + ('0 1 0' * (1 - player.vehicle_reload1)), 1);
+ vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
+ traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
+ vector vf = ad;
+ ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
+ traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+ UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
ad = 0.5 * (ad + vf);
#endif
- crosshair_trace(player);
+ crosshair_trace(this);
ad = vectoangles(normalize(trace_endpos - ad));
- ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromAngles(ad))) - spider.tur_head.angles;
+ ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(vehic.angles), AnglesTransform_FromAngles(ad))) - vehic.tur_head.angles;
ad = AnglesTransform_Normalize(ad, true);
- //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
+ //UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload2) + ('0 1 0' * (1 - this.vehicle_reload2)), 2);
// Rotate head
- ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
+ float ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
ad_y = bound(-ftmp, ad_y, ftmp);
- spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
+ vehic.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, vehic.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
// Pitch head
ad_x = bound(ftmp * -1, ad_x, ftmp);
- spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
+ vehic.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, vehic.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
- //fixedmakevectors(spider.angles);
- makevectors(spider.angles + '-2 0 0' * spider.angles_x);
+ //fixedmakevectors(vehic.angles);
+ makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
- movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
+ movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
- if(IS_ONGROUND(spider))
- spider.jump_delay = time; // reset now so movement can begin
+ if(IS_ONGROUND(vehic))
+ vehic.jump_delay = time; // reset now so movement can begin
- //if(IS_ONGROUND(spider))
+ //if(IS_ONGROUND(vehic))
{
- if(IS_ONGROUND(spider))
- if(spider.frame == 4 && self.tur_head.wait != 0)
+ if(IS_ONGROUND(vehic))
+ if(vehic.frame == 4 && vehic.tur_head.wait != 0)
{
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
- spider.frame = 5;
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_LAND, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.frame = 5;
}
- if (!PHYS_INPUT_BUTTON_JUMP(player))
- PHYS_INPUT_BUTTON_JUMP(spider) = false;
+ if (!PHYS_INPUT_BUTTON_JUMP(this))
+ PHYS_INPUT_BUTTON_JUMP(vehic) = false;
- if((IS_ONGROUND(spider)) && PHYS_INPUT_BUTTON_JUMP(player) && !PHYS_INPUT_BUTTON_JUMP(spider) && self.tur_head.wait < time)
+ if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !PHYS_INPUT_BUTTON_JUMP(vehic) && vehic.tur_head.wait < time)
{
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM);
//dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
- self.delay = 0;
+ vehic.delay = 0;
- self.tur_head.wait = time + 2;
- spider.jump_delay = time + 2;
- PHYS_INPUT_BUTTON_JUMP(spider) = true; // set spider's jump
- //PHYS_INPUT_BUTTON_JUMP(player) = false;
+ vehic.tur_head.wait = time + 2;
+ vehic.jump_delay = time + 2;
+ PHYS_INPUT_BUTTON_JUMP(vehic) = true; // set spider's jump
+ //PHYS_INPUT_BUTTON_JUMP(this) = false;
vector movefix = '0 0 0';
- if(player.movement_x > 0) movefix_x = 1;
- if(player.movement_x < 0) movefix_x = -1;
- if(player.movement_y > 0) movefix_y = 1;
- if(player.movement_y < 0) movefix_y = -1;
+ if(this.movement_x > 0) movefix_x = 1;
+ if(this.movement_x < 0) movefix_x = -1;
+ if(this.movement_y > 0) movefix_y = 1;
+ if(this.movement_y < 0) movefix_y = -1;
vector rt = movefix_y * v_right;
vector sd = movefix_x * v_forward;
if(movefix_y == 0 && movefix_x == 0)
sd = v_forward; // always do forward
- UNSET_ONGROUND(spider);
+ UNSET_ONGROUND(vehic);
- spider.velocity = sd * 700 + rt * 600 + v_up * 600;
- spider.frame = 4;
+ vehic.velocity = sd * 700 + rt * 600 + v_up * 600;
+ vehic.frame = 4;
}
- else if(time >= spider.jump_delay)
+ else if(time >= vehic.jump_delay)
{
- if(!player.movement)
+ if(!this.movement)
{
- if(IS_ONGROUND(spider))
+ if(IS_ONGROUND(vehic))
{
- if(self.sound_nexttime < time || self.delay != 3)
+ if(vehic.sound_nexttime < time || vehic.delay != 3)
{
- self.delay = 3;
- self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
+ vehic.delay = 3;
+ vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
//dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_IDLE, VOL_VEHICLEENGINE, ATTEN_NORM);
}
- movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
- spider.frame = 5;
+ movelib_brake_simple(vehic, autocvar_g_vehicle_spiderbot_speed_stop);
+ vehic.frame = 5;
}
}
else
{
// Turn Body
- if(player.movement_x == 0 && player.movement_y != 0)
+ if(this.movement_x == 0 && this.movement_y != 0)
ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime;
else
ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
- ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
- spider.angles_y = anglemods(spider.angles_y + ftmp);
- spider.tur_head.angles_y -= ftmp;
+ ftmp = bound(-ftmp, vehic.tur_head.angles_y, ftmp);
+ vehic.angles_y = anglemods(vehic.angles_y + ftmp);
+ vehic.tur_head.angles_y -= ftmp;
- if(player.movement_x != 0)
+ if(this.movement_x != 0)
{
- if(player.movement_x > 0)
+ if(this.movement_x > 0)
{
- player.movement_x = 1;
- if(IS_ONGROUND(spider))
- spider.frame = 0;
+ this.movement_x = 1;
+ if(IS_ONGROUND(vehic))
+ vehic.frame = 0;
}
- else if(player.movement_x < 0)
+ else if(this.movement_x < 0)
{
- player.movement_x = -1;
- if(IS_ONGROUND(spider))
- spider.frame = 1;
+ this.movement_x = -1;
+ if(IS_ONGROUND(vehic))
+ vehic.frame = 1;
}
- player.movement_y = 0;
- float oldvelz = spider.velocity_z;
- movelib_move_simple(self, normalize(v_forward * player.movement_x),((PHYS_INPUT_BUTTON_JUMP(player)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
- spider.velocity_z = oldvelz;
+ this.movement_y = 0;
+ float oldvelz = vehic.velocity_z;
+ movelib_move_simple(vehic, normalize(v_forward * this.movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+ vehic.velocity_z = oldvelz;
float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
- if(spider.velocity_z <= 20) // not while jumping
- spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
- if(IS_ONGROUND(spider))
- if(self.sound_nexttime < time || self.delay != 1)
+ if(vehic.velocity_z <= 20) // not while jumping
+ vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+ if(IS_ONGROUND(vehic))
+ if(vehic.sound_nexttime < time || vehic.delay != 1)
{
- self.delay = 1;
- self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.delay = 1;
+ vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_WALK, VOL_VEHICLEENGINE, ATTEN_NORM);
//dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
}
}
- else if(player.movement_y != 0)
+ else if(this.movement_y != 0)
{
- if(player.movement_y < 0)
+ if(this.movement_y < 0)
{
- player.movement_y = -1;
- if(IS_ONGROUND(spider))
- spider.frame = 2;
+ this.movement_y = -1;
+ if(IS_ONGROUND(vehic))
+ vehic.frame = 2;
}
- else if(player.movement_y > 0)
+ else if(this.movement_y > 0)
{
- player.movement_y = 1;
- if(IS_ONGROUND(spider))
- spider.frame = 3;
+ this.movement_y = 1;
+ if(IS_ONGROUND(vehic))
+ vehic.frame = 3;
}
- float oldvelz = spider.velocity_z;
- movelib_move_simple(self, normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
- spider.velocity_z = oldvelz;
+ float oldvelz = vehic.velocity_z;
+ movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+ vehic.velocity_z = oldvelz;
float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
- if(spider.velocity_z <= 20) // not while jumping
- spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
- if(IS_ONGROUND(spider))
- if(self.sound_nexttime < time || self.delay != 2)
+ if(vehic.velocity_z <= 20) // not while jumping
+ vehic.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+ if(IS_ONGROUND(vehic))
+ if(vehic.sound_nexttime < time || vehic.delay != 2)
{
- self.delay = 2;
- self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
- sound (self, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
+ vehic.delay = 2;
+ vehic.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
+ sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_STRAFE, VOL_VEHICLEENGINE, ATTEN_NORM);
//dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
}
}
}
}
- self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
- self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
+ vehic.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit);
+ vehic.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, vehic.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit);
- if(!forbidWeaponUse(player))
- if(PHYS_INPUT_BUTTON_ATCK(player))
+ if(!forbidWeaponUse(this))
+ if(PHYS_INPUT_BUTTON_ATCK(this))
{
- spider.cnt = time;
- if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single[0] <= time)
+ vehic.cnt = time;
+ if(vehic.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && vehic.tur_head.attack_finished_single[0] <= time)
{
entity gun;
vector v;
- spider.misc_bulletcounter += 1;
+ vehic.misc_bulletcounter += 1;
- setself(player);
-
- gun = (spider.misc_bulletcounter % 2) ? spider.gun1 : spider.gun2;
+ gun = (vehic.misc_bulletcounter % 2) ? vehic.gun1 : vehic.gun2;
v = gettaginfo(gun, gettagindex(gun, "barrels"));
v_forward = normalize(v_forward);
v += v_forward * 50;
- fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
- autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
+ fireBullet(this, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+ autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
//trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
- pointparticles(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
-
- setself(spider);
-
- spider.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
- spider.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
- player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
- spider.gun1.angles_z += 45;
- spider.gun2.angles_z -= 45;
- if(spider.gun1.angles_z >= 360)
+ Send_Effect(EFFECT_SPIDERBOT_MINIGUN_MUZZLEFLASH, v, v_forward * 2500, 1);
+
+ vehic.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
+ vehic.tur_head.attack_finished_single[0] = time + autocvar_g_vehicle_spiderbot_minigun_refire;
+ this.vehicle_ammo1 = (vehic.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
+ vehic.gun1.angles_z += 45;
+ vehic.gun2.angles_z -= 45;
+ if(vehic.gun1.angles_z >= 360)
{
- spider.gun1.angles_z = 0;
- spider.gun2.angles_z = 0;
+ vehic.gun1.angles_z = 0;
+ vehic.gun2.angles_z = 0;
}
}
}
else
- vehicles_regen(spider.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
+ vehicles_regen(vehic, vehic.cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
- spiderbot_rocket_do();
+ spiderbot_rocket_do(vehic);
- if(self.vehicle_flags & VHF_SHIELDREGEN)
- vehicles_regen(spider.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
+ if(vehic.vehicle_flags & VHF_SHIELDREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
- if(self.vehicle_flags & VHF_HEALTHREGEN)
- vehicles_regen(spider.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
+ if(vehic.vehicle_flags & VHF_HEALTHREGEN)
+ vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, frametime, false);
- PHYS_INPUT_BUTTON_ATCK(player) = PHYS_INPUT_BUTTON_ATCK2(player) = false;
- //player.vehicle_ammo2 = spider.tur_head.frame;
- player.vehicle_ammo2 = (9 - spider.tur_head.frame) / 8 * 100; // Percentage, like ammo1
+ PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ //this.vehicle_ammo2 = vehic.tur_head.frame;
+ this.vehicle_ammo2 = (9 - vehic.tur_head.frame) / 8 * 100; // Percentage, like ammo1
- if(spider.gun2.cnt <= time)
- player.vehicle_reload2 = 100;
+ if(vehic.gun2.cnt <= time)
+ this.vehicle_reload2 = 100;
else
- player.vehicle_reload2 = 100 - ((spider.gun2.cnt - time) / spider.attack_finished_single[0]) * 100;
+ this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100;
- setorigin(player, spider.origin + '0 0 1' * spider.maxs_z);
- player.velocity = spider.velocity;
+ setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z);
+ this.velocity = vehic.velocity;
- VEHICLE_UPDATE_PLAYER(player, health, spiderbot);
+ VEHICLE_UPDATE_PLAYER(this, vehic, health, spiderbot);
- if(self.vehicle_flags & VHF_HASSHIELD)
- VEHICLE_UPDATE_PLAYER(player, shield, spiderbot);
-
- setself(player);
- return 1;
+ if(vehic.vehicle_flags & VHF_HASSHIELD)
+ VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
}
void spiderbot_exit(float eject)
setorigin(self.owner , spot);
}
- antilag_clear(self.owner);
+ antilag_clear(self.owner, CS(self.owner));
self.owner = world;
}
spawnfunc(vehicle_spiderbot)
{
- if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
- if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_spiderbot) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { remove(this); return; }
}
METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
{
if(autocvar_g_vehicle_spiderbot_bouncepain)
- vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
}
METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
{
+ SELFPARAM();
self.vehicle_weapon2mode = SBRM_GUIDE;
self.movetype = MOVETYPE_WALK;
CSQCVehicleSetup(self.owner, 0);
}
METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
{
+ SELFPARAM();
if(IS_ONGROUND(self))
movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop);
}
}
METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
{
+ SELFPARAM();
if(!self.gun1)
{
self.vehicles_impulse = spiderbot_impulse;
METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
{
if(autocvar_g_vehicle_spiderbot_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_spiderbot_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_spiderbot_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
- self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
- self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
- self.max_health = self.vehicle_health;
- self.pushable = true; // spiderbot can use jumppads
+ instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+ instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+ instance.max_health = instance.vehicle_health;
+ instance.pushable = true; // spiderbot can use jumppads
}
#endif // SVQC
-#ifndef VEHICLE_SPIDERBOT_WEAPONS_H
-#define VEHICLE_SPIDERBOT_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-#endif
+#include "spiderbot_weapons.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_spiderbot_minigun_damage;
-float autocvar_g_vehicle_spiderbot_minigun_refire;
-float autocvar_g_vehicle_spiderbot_minigun_spread;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_max;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
-float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
-float autocvar_g_vehicle_spiderbot_minigun_force;
-float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
-
-float autocvar_g_vehicle_spiderbot_rocket_damage;
-float autocvar_g_vehicle_spiderbot_rocket_force;
-float autocvar_g_vehicle_spiderbot_rocket_radius;
-float autocvar_g_vehicle_spiderbot_rocket_speed;
-float autocvar_g_vehicle_spiderbot_rocket_spread;
-float autocvar_g_vehicle_spiderbot_rocket_refire;
-float autocvar_g_vehicle_spiderbot_rocket_refire2;
-float autocvar_g_vehicle_spiderbot_rocket_reload;
-float autocvar_g_vehicle_spiderbot_rocket_health;
-float autocvar_g_vehicle_spiderbot_rocket_noise;
-float autocvar_g_vehicle_spiderbot_rocket_turnrate;
-float autocvar_g_vehicle_spiderbot_rocket_lifetime;
-
void spiderbot_rocket_artillery()
{SELFPARAM();
self.nextthink = time;
self.use();
}
-void spiderbot_guide_release()
-{SELFPARAM();
+void spiderbot_guide_release(entity this)
+{
entity rkt;
- rkt = findchainentity(realowner, self.owner);
+ rkt = findchainentity(realowner, this.owner);
if(!rkt)
return;
- crosshair_trace(self.owner);
+ crosshair_trace(this.owner);
while(rkt)
{
if(rkt.think == spiderbot_rocket_guided)
return sdir * vs + '0 0 1' * vz;
}
-void spiderbot_rocket_do()
-{SELFPARAM();
+void spiderbot_rocket_do(entity this)
+{;
vector v;
entity rocket = world;
- if (self.wait != -10)
+ if (this.wait != -10)
{
- if (PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.vehicle_weapon2mode == SBRM_GUIDE)
+ if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.vehicle_weapon2mode == SBRM_GUIDE)
{
- if (self.wait == 1)
- if (self.tur_head.frame == 9 || self.tur_head.frame == 1)
+ if (this.wait == 1)
+ if (this.tur_head.frame == 9 || this.tur_head.frame == 1)
{
- if(self.gun2.cnt < time && self.tur_head.frame == 9)
- self.tur_head.frame = 1;
+ if(this.gun2.cnt < time && this.tur_head.frame == 9)
+ this.tur_head.frame = 1;
return;
}
- self.wait = 1;
+ this.wait = 1;
}
else
{
- if(self.wait)
- spiderbot_guide_release();
+ if(this.wait)
+ spiderbot_guide_release(this);
- self.wait = 0;
+ this.wait = 0;
}
}
- if(self.gun2.cnt > time)
+ if(this.gun2.cnt > time)
return;
- if (self.tur_head.frame >= 9)
+ if (this.tur_head.frame >= 9)
{
- self.tur_head.frame = 1;
- self.wait = 0;
+ this.tur_head.frame = 1;
+ this.wait = 0;
}
- if(self.wait != -10)
- if(!PHYS_INPUT_BUTTON_ATCK2(self.owner))
+ if(this.wait != -10)
+ if(!PHYS_INPUT_BUTTON_ATCK2(this.owner))
return;
- if(forbidWeaponUse(self.owner))
+ if(forbidWeaponUse(this.owner))
return;
- v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
+ v = gettaginfo(this.tur_head,gettagindex(this.tur_head,"tag_fire"));
- switch(self.vehicle_weapon2mode)
+ switch(this.vehicle_weapon2mode)
{
case SBRM_VOLLY:
- rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
- DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
- crosshair_trace(self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
+ crosshair_trace(this.owner);
float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
_dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
rocket.nextthink = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
rocket.think = vehicles_projectile_explode;
- if(PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.tur_head.frame == 1)
- self.wait = -10;
+ if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
+ this.wait = -10;
break;
case SBRM_GUIDE:
- rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
- DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner);
- crosshair_trace(self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, this.owner);
+ crosshair_trace(this.owner);
rocket.pos1 = trace_endpos;
rocket.nextthink = time;
rocket.think = spiderbot_rocket_guided;
break;
case SBRM_ARTILLERY:
- rocket = vehicles_projectile(EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND(ROCKET_FIRE),
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
- DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
- crosshair_trace(self.owner);
+ crosshair_trace(this.owner);
rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
rocket.pos1_z = trace_endpos_z;
- traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
float h1 = 0.75 * vlen(v - trace_endpos);
//v = trace_endpos;
- traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
float h2 = 0.75 * vlen(rocket.pos1 - v);
rocket.velocity = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
rocket.cnt = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
- self.tur_head.frame += 1;
- if (self.tur_head.frame == 9)
- self.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
+ this.tur_head.frame += 1;
+ if (this.tur_head.frame == 9)
+ this.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
else
- self.attack_finished_single[0] = ((self.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
+ this.attack_finished_single[0] = ((this.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
- self.gun2.cnt = time + self.attack_finished_single[0];
+ this.gun2.cnt = time + this.attack_finished_single[0];
}
#endif
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+#ifdef SVQC
+void spiderbot_rocket_do(entity this);
+#endif
+
+// 400 (x2) DPS
+float autocvar_g_vehicle_spiderbot_minigun_damage = 24;
+float autocvar_g_vehicle_spiderbot_minigun_refire = 0.06;
+float autocvar_g_vehicle_spiderbot_minigun_spread = 0.015;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_cost = 1;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_max = 100;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_regen = 40;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause = 1;
+float autocvar_g_vehicle_spiderbot_minigun_force = 9;
+float autocvar_g_vehicle_spiderbot_minigun_solidpenetration = 32;
+
+float autocvar_g_vehicle_spiderbot_rocket_damage = 50;
+float autocvar_g_vehicle_spiderbot_rocket_force = 150;
+float autocvar_g_vehicle_spiderbot_rocket_radius = 250;
+float autocvar_g_vehicle_spiderbot_rocket_speed = 3500;
+float autocvar_g_vehicle_spiderbot_rocket_spread = 0.05;
+float autocvar_g_vehicle_spiderbot_rocket_refire = 0.1;
+// volley
+float autocvar_g_vehicle_spiderbot_rocket_refire2 = 0.025;
+float autocvar_g_vehicle_spiderbot_rocket_reload = 4;
+float autocvar_g_vehicle_spiderbot_rocket_health = 100;
+float autocvar_g_vehicle_spiderbot_rocket_noise = 0.2;
+float autocvar_g_vehicle_spiderbot_rocket_turnrate = 0.25;
+float autocvar_g_vehicle_spiderbot_rocket_lifetime = 20;
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "calculations.qc"
+#include "config.qc"
* call again with ""
* remove the ent
*/
-void CL_WeaponEntity_SetModel(entity this, string name)
+void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
{
if (name == "")
{
// check if an instant weapon switch occurred
setorigin(this, this.view_ofs);
+ if (!_anim) return;
// reset animstate now
this.wframe = WFRAME_IDLE;
setanim(this, this.anim_idle, true, false, true);
#ifndef WEAPONS_ALL_H
#define WEAPONS_ALL_H
-#include "../command/all.qh"
-#include "../stats.qh"
+#include <common/command/all.qh>
+#include <common/stats.qh>
#include "config.qh"
// weapon sets
-typedef vector WepSet;
+USING(WepSet, vector);
#ifdef SVQC
void WriteWepSet(float dest, WepSet w);
#endif
#include <common/models/all.qh>
#endif
-#include "../util.qh"
+#include <common/util.qh>
#ifdef SVQC
#include <server/bot/aim.qh>
}
STATIC_INIT_LATE(W_PROP_reloader)
{
+ SELFPARAM();
entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
- WITH(entity, self, e, (e.think = W_PROP_think)());
+ WITHSELF(e, (e.think = W_PROP_think)());
}
#endif
.WFRAME wframe;
vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn);
-void CL_WeaponEntity_SetModel(entity this, string name);
+void CL_WeaponEntity_SetModel(entity this, string name, bool _anim);
#endif
#endif
#ifndef WEAPON_H
#define WEAPON_H
-#include "../items/item/pickup.qh"
-#include "../stats.qh"
+#include <common/items/item/pickup.qh>
+#include <common/stats.qh>
+
+#ifdef SVQC
+#include <common/effects/qc/all.qh>
+#endif
const int MAX_WEAPONSLOTS = 2;
.entity weaponentities[MAX_WEAPONSLOTS];
}
ENDCLASS(Weapon)
-#include "../items/all.qh"
+#include <common/items/all.qh>
CLASS(WeaponPickup, Pickup)
ATTRIB(WeaponPickup, m_weapon, Weapon, NULL)
ATTRIB(WeaponPickup, m_name, string, string_null)
--- /dev/null
+// generated file; do not modify
+#include "arc.qc"
+#include "blaster.qc"
+#include "crylink.qc"
+#include "devastator.qc"
+#include "electro.qc"
+#include "fireball.qc"
+#include "hagar.qc"
+#include "hlac.qc"
+#include "hook.qc"
+#include "machinegun.qc"
+#include "minelayer.qc"
+#include "mortar.qc"
+#include "porto.qc"
+#include "rifle.qc"
+#include "seeker.qc"
+#include "shockwave.qc"
+#include "shotgun.qc"
+#include "tuba.qc"
+#include "vaporizer.qc"
+#include "vortex.qc"
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Arc_Bolt_Touch()
W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
- W_SetupShot(self, false, 2, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
+ W_SetupShot(self, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
self.owner,
true,
0,
- "",
+ SND_Null,
0,
WEP_CVAR(arc, beam_damage) * coefficient,
WEP_CVAR(arc, beam_range)
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITH(entity, self, beam, beam.think());
+ WITHSELF(beam, beam.think());
}
void Arc_Smoke()
{SELFPARAM();
makevectors(self.v_angle);
- W_SetupShot_Range(self,true,0,"",0,0,0);
+ W_SetupShot_Range(self,true,0,SND_Null,0,0,0);
vector smoke_origin = w_shotorg + self.velocity*frametime;
if ( self.arc_overheat > time )
if(WEP_CVAR(arc, beam_botaimspeed))
{
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+ self,
WEP_CVAR(arc, beam_botaimspeed),
0,
WEP_CVAR(arc, beam_botaimlifetime),
else
{
PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
+ self,
1000000,
0,
0.001,
}
METHOD(Arc, wr_drop, void(entity thiswep))
{
+ SELFPARAM();
weapon_dropevent_item.arc_overheat = self.arc_overheat;
weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
self.arc_overheat = 0;
}
METHOD(Arc, wr_pickup, void(entity thiswep))
{
+ SELFPARAM();
if ( !client_hasweapon(self, thiswep, false, false) &&
weapon_dropevent_item.arc_overheat > time )
{
METHOD(Arc, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
if(w_deathtype & HITTYPE_SECONDARY)
{
vector org2;
{SELFPARAM();
vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
- W_SetupShot_Dir(actor, s_forward, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, atk_damage);
+ W_SetupShot_Dir(actor, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage);
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
entity missile = new(blasterbolt);
if (time >= missile.nextthink)
{
- WITH(entity, self, missile, missile.think());
+ WITHSELF(missile, missile.think());
}
}
METHOD(Blaster, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(WEP_CVAR(blaster, secondary))
{
if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage))
- { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
+ { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); }
else
- { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
}
else
- { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); }
}
METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire))
METHOD(Blaster, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.ammo_field = ammo_none;
}
METHOD(Blaster, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
if(WEP_CVAR_PRI(crylink, joinexplode))
maxdmg += WEP_CVAR_PRI(crylink, joinexplode_damage);
- W_SetupShot(self, false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, maxdmg);
+ W_SetupShot(self, false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, maxdmg);
forward = v_forward;
right = v_right;
up = v_up;
if(WEP_CVAR_SEC(crylink, joinexplode))
maxdmg += WEP_CVAR_SEC(crylink, joinexplode_damage);
- W_SetupShot(self, false, 2, SND(CRYLINK_FIRE2), CH_WEAPON_A, maxdmg);
+ W_SetupShot(self, false, 2, SND_CRYLINK_FIRE2, CH_WEAPON_A, maxdmg);
forward = v_forward;
right = v_right;
up = v_up;
{
SELFPARAM();
if(random() < 0.10)
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false);
else
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false);
}
METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND_RELOAD);
}
METHOD(Crylink, wr_suicidemessage, Notification(entity thiswep))
{
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
}
void W_Devastator_Attack(Weapon thiswep)
W_DecreaseAmmo(thiswep, self, WEP_CVAR(devastator, ammo));
- W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(devastator, damage));
+ W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
missile = WarpZone_RefSys_SpawnSameRefSys(self);
METHOD(Devastator, wr_aim, void(entity thiswep))
{
// aim and decide to fire if appropriate
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
{
// decide whether to detonate rockets
#else
METHOD(Devastator, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
// aim and decide to fire if appropriate
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false);
if(skill >= 2) // skill 0 and 1 bots won't detonate rockets!
{
// decide whether to detonate rockets
selfdamage = selfdamage + d;
else if(targ.team == self.team && teamplay)
teamdamage = teamdamage + d;
- else if(bot_shouldattack(targ))
+ else if(bot_shouldattack(self, targ))
enemydamage = enemydamage + d;
targ = targ.chain;
}
}
METHOD(Devastator, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.rl_release = 1;
}
METHOD(Devastator, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
#if 0
// don't switch while guiding a missile
if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
}
METHOD(Devastator, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
self.rl_release = 0;
}
METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, WEP_CVAR(devastator, ammo), SND_RELOAD);
}
METHOD(Devastator, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Devastator, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
'0 0 -3',
false,
2,
- SND(ELECTRO_FIRE),
+ SND_ELECTRO_FIRE,
CH_WEAPON_A,
WEP_CVAR_PRI(electro, damage)
);
'0 0 -4',
false,
2,
- SND(ELECTRO_FIRE2),
+ SND_ELECTRO_FIRE2,
CH_WEAPON_A,
WEP_CVAR_SEC(electro, damage)
);
METHOD(Electro, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
PHYS_INPUT_BUTTON_ATCK(self) = PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(vdist(self.origin - self.enemy.origin, >, 1000)) { self.bot_secondary_electromooth = 0; }
if(self.bot_secondary_electromooth == 0)
float shoot;
if(WEP_CVAR_PRI(electro, speed))
- shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
+ shoot = bot_aim(self, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
else
- shoot = bot_aim(1000000, 0, 0.001, false);
+ shoot = bot_aim(self, 1000000, 0, 0.001, false);
if(shoot)
{
}
else
{
- if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
+ if(bot_aim(self, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
{
PHYS_INPUT_BUTTON_ATCK2(self) = true;
if(random() < 0.03) self.bot_secondary_electromooth = 0;
}
METHOD(Electro, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
return ammo_amount;
}
METHOD(Electro, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount;
if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
{
}
METHOD(Electro, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
self.electro_secondarytime = time;
}
METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
}
METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Electro, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_SECONDARY)
if(this.health <= 0)
{
this.cnt = 1;
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
}
}
{SELFPARAM();
entity proj;
- W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND(FIREBALL_FIRE2), CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
+ W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
Send_Effect(EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
void W_Fireball_AttackEffect(float i, vector f_diff)
{SELFPARAM();
- W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, "", 0, 0);
+ W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0);
w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
f_diff = '+1.25 +3.75 0';
break;
}
- W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, SND(FIREBALL_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage));
+ W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 2, SND_FIREBALL_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(fireball, damage));
traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self);
w_shotorg = trace_endpos;
METHOD(Fireball, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(self.bot_primary_fireballmooth == 0)
{
- if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
+ if(bot_aim(self, WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false))
{
PHYS_INPUT_BUTTON_ATCK(self) = true;
if(random() < 0.02) self.bot_primary_fireballmooth = 0;
}
else
{
- if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
+ if(bot_aim(self, WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true))
{
PHYS_INPUT_BUTTON_ATCK2(self) = true;
if(random() < 0.01) self.bot_primary_fireballmooth = 1;
}
METHOD(Fireball, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.ammo_field = ammo_none;
}
METHOD(Fireball, wr_checkammo1, bool(entity thiswep))
}
METHOD(Fireball, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
self.fireball_primarytime = time;
}
METHOD(Fireball, wr_suicidemessage, Notification(entity thiswep))
METHOD(Fireball, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
if(w_deathtype & HITTYPE_SECONDARY)
{
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Hagar_Touch()
W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(hagar, ammo));
- W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
+ W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage));
Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(hagar, ammo));
- W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
+ W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
weapon_prepareattack_do(self, weaponentity, true, WEP_CVAR_SEC(hagar, refire));
- W_SetupShot(self, false, 2, SND(HAGAR_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
+ W_SetupShot(self, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage));
Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
forward = v_forward;
METHOD(Hagar, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(random()>0.15)
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false);
}
METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(Hagar, wr_gonethink, void(entity thiswep))
{
+ SELFPARAM();
// we lost the weapon and want to prepare switching away
if(self.hagar_load)
{
}
METHOD(Hagar, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.hagar_loadblock = false;
if(self.hagar_load)
}
METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
return ammo_amount;
}
METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
return ammo_amount;
}
METHOD(Hagar, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
self.hagar_load = 0;
}
METHOD(Hagar, wr_playerdeath, void(entity thiswep))
{
+ SELFPARAM();
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
// if we have any rockets loaded when we die, release them
if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
}
METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
+ SELFPARAM();
if(!self.hagar_load) // require releasing loaded rockets first
- W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
+ W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND_RELOAD);
}
METHOD(Hagar, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Hagar, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_HAGAR_EXPLODE, org2, '0 0 0', 1);
if(self.crouch)
spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
- W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
+ W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage));
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
if(!autocvar_g_norecoil)
{
if(self.crouch)
spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
- W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
+ W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage));
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
missile = new(hlacbolt);
METHOD(HLAC, wr_aim, void(entity thiswep))
{
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
+ SELFPARAM();
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false);
}
METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
return ammo_amount;
}
METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
return ammo_amount;
}
METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND_RELOAD);
}
METHOD(HLAC, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(HLAC, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
}
void W_Hook_Touch2()
void W_Hook_Attack2(Weapon thiswep, entity actor)
{
//W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
- W_SetupShot(actor, false, 4, SND(HOOKBOMB_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
+ W_SetupShot(actor, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage));
entity gren = new(hookbomb);
gren.owner = gren.realowner = actor;
METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
+ SELFPARAM();
if (fire & 1) {
if(!actor.hook)
if(!(actor.hook_state & HOOK_WAITING_FOR_RELEASE))
{
if (actor.hook)
RemoveGrapplingHook(actor);
- WITH(entity, self, actor, FireGrapplingHook());
+ WITHSELF(actor, FireGrapplingHook());
actor.hook_state &= ~HOOK_FIRING;
actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
}
}
METHOD(Hook, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
}
METHOD(Hook, wr_checkammo1, bool(Hook thiswep))
{
+ SELFPARAM();
if (!thiswep.ammo_factor) return true;
if(self.hook)
return self.ammo_fuel > 0;
}
METHOD(Hook, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
RemoveGrapplingHook(self);
self.hook_time = 0;
self.hook_refire = time;
METHOD(Hook, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_HOOK_EXPLODE, org2, '0 0 0', 1);
void Remove_GrapplingHook(entity this)
{
sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+
+ if(csqcplayer && csqcplayer.hook == this)
+ csqcplayer.hook = NULL;
}
NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
int myowner = ReadByte();
self.owner = playerslots[myowner - 1];
self.sv_entnum = myowner;
+ if(csqcplayer && myowner == player_localentnum)
+ csqcplayer.hook = self;
switch(self.HookType)
{
default:
void W_MachineGun_Attack(Weapon thiswep, int deathtype, .entity weaponentity)
{SELFPARAM();
- W_SetupShot(self, true, 0, SND(UZI_FIRE), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
+ W_SetupShot(self, true, 0, SND_UZI_FIRE, CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
if(!autocvar_g_norecoil)
{
self.punchangle_x = random() - 0.5;
ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
if(self.misc_bulletcounter == 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
else
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_DecreaseAmmo(WEP_MACHINEGUN, actor, WEP_CVAR(machinegun, sustained_ammo));
- W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+ W_SetupShot(actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
if(!autocvar_g_norecoil)
{
actor.punchangle_x = random() - 0.5;
}
machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
- fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- W_SetupShot(actor, true, 0, SND(UZI_FIRE), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
+ W_SetupShot(actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
if(!autocvar_g_norecoil)
{
actor.punchangle_x = random() - 0.5;
actor.punchangle_y = random() - 0.5;
}
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
METHOD(MachineGun, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
else
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
}
METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount;
if(WEP_CVAR(machinegun, mode) == 1)
ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
}
METHOD(MachineGun, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount;
if(WEP_CVAR(machinegun, mode) == 1)
ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
}
METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND_RELOAD);
}
METHOD(MachineGun, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(MachineGun, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1);
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
}
void W_MineLayer_Attack(Weapon thiswep)
W_DecreaseAmmo(thiswep, self, WEP_CVAR(minelayer, ammo));
- W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND(MINE_FIRE), CH_WEAPON_A, WEP_CVAR(minelayer, damage));
+ W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
mine = WarpZone_RefSys_SpawnSameRefSys(self);
METHOD(MineLayer, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
// aim and decide to fire if appropriate
if(self.minelayer_mines >= WEP_CVAR(minelayer, limit))
PHYS_INPUT_BUTTON_ATCK(self) = false;
else
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false);
if(skill >= 2) // skill 0 and 1 bots won't detonate mines!
{
// decide whether to detonate mines
selfdamage = selfdamage + d;
else if(targ.team == self.team && teamplay)
teamdamage = teamdamage + d;
- else if(bot_shouldattack(targ))
+ else if(bot_shouldattack(self, targ))
enemydamage = enemydamage + d;
targ = targ.chain;
}
}
METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
int slot = 0; // TODO: unhardcode
// don't switch while placing a mine
if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
}
METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
{
+ SELFPARAM();
self.minelayer_mines = 0;
}
METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, WEP_CVAR(minelayer, ammo), SND_RELOAD);
}
METHOD(MineLayer, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(MineLayer, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
}
void W_Mortar_Grenade_Think1()
W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(mortar, ammo));
- W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
+ W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
W_DecreaseAmmo(thiswep, self, WEP_CVAR_SEC(mortar, ammo));
- W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND(GRENADE_FIRE), CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
+ W_SetupShot_ProjectileSize(self, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
METHOD(Mortar, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
{
- if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
+ if(bot_aim(self, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true))
{
PHYS_INPUT_BUTTON_ATCK(self) = true;
if(random() < 0.01) self.bot_secondary_grenademooth = 1;
}
else
{
- if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
+ if(bot_aim(self, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true))
{
PHYS_INPUT_BUTTON_ATCK2(self) = true;
if(random() < 0.02) self.bot_secondary_grenademooth = 0;
}
METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
return ammo_amount;
}
METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
return ammo_amount;
}
METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND_RELOAD); // WEAPONTODO
}
METHOD(Mortar, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Mortar, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 12;
pointparticles(EFFECT_GRENADE_EXPLODE, org2, '0 0 0', 1);
{SELFPARAM();
if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
{
- WITH(entity, self, p.porto_current, W_Porto_Fail(1));
+ WITHSELF(p.porto_current, W_Porto_Fail(1));
}
}
{SELFPARAM();
entity gren;
- W_SetupShot(self, false, 4, SND(PORTO_FIRE), CH_WEAPON_A, 0);
+ W_SetupShot(self, false, 4, SND_PORTO_FIRE, CH_WEAPON_A, 0);
// always shoot from the eye
w_shotdir = v_forward;
w_shotorg = self.origin + self.view_ofs + ((w_shotorg - self.origin - self.view_ofs) * v_forward) * v_forward;
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(!WEP_CVAR(porto, secondary))
- if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
+ if(bot_aim(self, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
PHYS_INPUT_BUTTON_ATCK(self) = true;
}
METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
spawnfunc(weapon_campingrifle) { spawnfunc_weapon_rifle(this); }
spawnfunc(weapon_sniperrifle) { spawnfunc_weapon_rifle(this); }
-void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound)
+void W_Rifle_FireBullet(Weapon thiswep, float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, Sound pSound)
{SELFPARAM();
float i;
}
for(i = 0; i < pShots; ++i)
- fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
+ fireBullet(self, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
if(autocvar_g_casings >= 2)
SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
void W_Rifle_Attack()
{
- W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND(CAMPINGRIFLE_FIRE));
+ W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_PRI(rifle, spread), WEP_CVAR_PRI(rifle, damage), WEP_CVAR_PRI(rifle, force), WEP_CVAR_PRI(rifle, solidpenetration), WEP_CVAR_PRI(rifle, ammo), WEP_RIFLE.m_id, WEP_CVAR_PRI(rifle, tracer), WEP_CVAR_PRI(rifle, shots), SND_CAMPINGRIFLE_FIRE);
}
void W_Rifle_Attack2()
{
- W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND(CAMPINGRIFLE_FIRE2));
+ W_Rifle_FireBullet(WEP_RIFLE, WEP_CVAR_SEC(rifle, spread), WEP_CVAR_SEC(rifle, damage), WEP_CVAR_SEC(rifle, force), WEP_CVAR_SEC(rifle, solidpenetration), WEP_CVAR_SEC(rifle, ammo), WEP_RIFLE.m_id | HITTYPE_SECONDARY, WEP_CVAR_SEC(rifle, tracer), WEP_CVAR_SEC(rifle, shots), SND_CAMPINGRIFLE_FIRE2);
}
.void() rifle_bullethail_attackfunc;
METHOD(Rifle, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
PHYS_INPUT_BUTTON_ATCK(self) = false;
PHYS_INPUT_BUTTON_ATCK2(self) = false;
if(vdist(self.origin - self.enemy.origin, >, 1000))
self.bot_secondary_riflemooth = 0;
if(self.bot_secondary_riflemooth == 0)
{
- if(bot_aim(1000000, 0, 0.001, false))
+ if(bot_aim(self, 1000000, 0, 0.001, false))
{
PHYS_INPUT_BUTTON_ATCK(self) = true;
if(random() < 0.01) self.bot_secondary_riflemooth = 1;
}
else
{
- if(bot_aim(1000000, 0, 0.001, false))
+ if(bot_aim(self, 1000000, 0, 0.001, false))
{
PHYS_INPUT_BUTTON_ATCK2(self) = true;
if(random() < 0.03) self.bot_secondary_riflemooth = 0;
}
METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
return ammo_amount;
}
METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
return ammo_amount;
}
METHOD(Rifle, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
}
METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND_RELOAD);
}
METHOD(Rifle, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Rifle, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_RIFLE_IMPACT, org2, w_backoff * 1000, 1);
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
}
/*
W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, missile_ammo));
makevectors(self.v_angle);
- W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(SEEKER_FIRE), CH_WEAPON_A, 0);
+ W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0);
w_shotorg += f_diff;
Send_Effect(EFFECT_SEEKER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
f_diff = '+1.25 +3.75 0';
break;
}
- W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(FLAC_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
+ W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage));
w_shotorg += f_diff;
Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
entity missile;
W_DecreaseAmmo(thiswep, self, WEP_CVAR(seeker, tag_ammo));
- W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND(TAG_FIRE), CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
+ W_SetupShot_ProjectileSize(self, '-2 -2 -2', '2 2 2', false, 2, SND_TAG_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count));
missile = new(seeker_tag);
missile.owner = missile.realowner = self;
METHOD(Seeker, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(WEP_CVAR(seeker, type) == 1)
if(W_Seeker_Tagged_Info(self, self.enemy) != world)
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false);
else
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
else
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false);
}
METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount;
if(WEP_CVAR(seeker, type) == 1)
{
}
METHOD(Seeker, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount;
if(WEP_CVAR(seeker, type) == 1)
{
}
METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND_RELOAD);
}
METHOD(Seeker, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Seeker, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2;
org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_BOUNCE)
meleetemp.owner = meleetemp.realowner = actor;
meleetemp.think = W_Shockwave_Melee_Think;
meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
- W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
+ W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
}
// SHOCKWAVE ATTACK MODE
float i, queue = 0;
// set up the shot direction
- W_SetupShot(self, false, 3, SND(LASERGUN_FIRE), CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
+ W_SetupShot(self, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
vector attack_hitpos = trace_endpos;
METHOD(Shockwave, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
- { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); }
+ { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); }
else
- { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); }
+ { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); }
}
METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
W_DecreaseAmmo(thiswep, self, WEP_CVAR_PRI(shotgun, ammo));
- W_SetupShot(self, true, 5, SND(SHOTGUN_FIRE), ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
+ W_SetupShot(self, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));
meleetemp.realowner = actor;
meleetemp.think = W_Shotgun_Melee_Think;
meleetemp.nextthink = time + WEP_CVAR_SEC(shotgun, melee_delay) * W_WeaponRateFactor();
- W_SetupShot_Range(actor, true, 0, "", 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
+ W_SetupShot_Range(actor, true, 0, SND_Null, 0, WEP_CVAR_SEC(shotgun, damage), WEP_CVAR_SEC(shotgun, melee_range));
}
// alternate secondary weapon frames
METHOD(Shotgun, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range)))
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false);
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false);
else
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false);
}
METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(Shotgun, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.ammo_field = ammo_none;
}
METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
return ammo_amount;
}
METHOD(Shotgun, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
if(IS_BOT_CLIENT(self))
if(vdist(self.origin - self.enemy.origin, >, WEP_CVAR_SEC(shotgun, melee_range)))
return false; // bots cannot use secondary out of range (fixes constant melee when out of ammo)
}
METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
+ SELFPARAM();
+ W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND_RELOAD); // WEAPONTODO
}
METHOD(Shotgun, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Shotgun, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2 = w_org + w_backoff * 2;
pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
if(!w_issilent && time - self.prevric > 0.25)
vector o;
float n;
- W_SetupShot(self, false, 2, "", 0, WEP_CVAR(tuba, damage));
+ W_SetupShot(self, false, 2, SND_Null, 0, WEP_CVAR(tuba, damage));
n = W_Tuba_GetNote(self, hittype);
string s = (i == 0) ? "tuba" :
(i == 1) ? "akordeon" :
"kleinbottle" ;
- CL_WeaponEntity_SetModel(viewmodel, s);
+ CL_WeaponEntity_SetModel(viewmodel, s, true);
}
#endif
#ifdef SVQC
break;
}
tuba_instrument_send(actor, actor.tuba_instrument);
- W_SetupShot(actor, false, 0, "", 0, 0);
+ W_SetupShot(actor, false, 0, SND_Null, 0, 0);
Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
actor.(weaponentity).state = WS_INUSE;
weapon_thinkf(actor, weaponentity, WFRAME_RELOAD, 0.5, w_ready);
this.enemy = NULL;
}
-void Ent_TubaNote_StopSound_self() { Ent_TubaNote_StopSound(self); }
+void Ent_TubaNote_StopSound_self() { SELFPARAM(); Ent_TubaNote_StopSound(self); }
NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
{
bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
- W_SetupShot(self, true, 0, "", CH_WEAPON_A, vaporizer_damage);
+ W_SetupShot(self, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage);
// handle sound separately so we can change the volume
// added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
sound (self, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
Weapon w = PS(self).m_weapon;
PS(self).m_weapon = WEP_ELECTRO;
- W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, autocvar_g_rm_laser_damage);
+ W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage);
PS(self).m_weapon = w;
Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
Weapon w = PS(self).m_weapon;
PS(self).m_weapon = WEP_ELECTRO;
- W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(ELECTRO_FIRE2), CH_WEAPON_A, autocvar_g_rm_laser_damage);
+ W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage);
PS(self).m_weapon = w;
Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
METHOD(Vaporizer, wr_aim, void(entity thiswep))
{
+ SELFPARAM();
if(self.(thiswep.ammo_field) > 0)
- PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false);
+ PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false);
else
- PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
+ PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
}
METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
}
METHOD(Vaporizer, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.ammo_field = (thiswep.ammo_field);
self.vaporizer_lasthit = 0;
}
METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
}
METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
if(!WEP_CVAR_SEC(vaporizer, ammo))
return true;
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
}
METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
self.vaporizer_lasthit = 0;
}
METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
+ SELFPARAM();
float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
float used_ammo;
if(WEP_CVAR_SEC(vaporizer, ammo))
else
used_ammo = vaporizer_ammo;
- W_Reload(self, used_ammo, SND(RELOAD));
+ W_Reload(self, used_ammo, SND_RELOAD);
}
METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Vaporizer, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2 = w_org + w_backoff * 6;
if(w_deathtype & HITTYPE_SECONDARY)
{
MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
{SELFPARAM();
// WEAPONTODO
- float xyspeed = vlen(vec2(self.velocity));
- if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+ float xyspeed = vlen(vec2(this.velocity));
+ if (PS(this).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
{
// add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
// add the extra charge
- self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+ this.vortex_charge = min(1, this.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
}
}
mydmg *= charge;
myforce *= charge;
- W_SetupShot(self, true, 5, SND(NEXFIRE), CH_WEAPON_A, mydmg);
+ W_SetupShot(self, true, 5, SND_NEXFIRE, CH_WEAPON_A, mydmg);
if(charge > WEP_CVAR(vortex, charge_animlimit) && WEP_CVAR(vortex, charge_animlimit)) // if the Vortex is overcharged, we play an extra sound
{
sound(self, CH_WEAPON_B, SND_NEXCHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(vortex, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(vortex, charge_animlimit)), ATTN_NORM);
METHOD(Vortex, wr_aim, void(entity thiswep))
{
- if(bot_aim(1000000, 0, 1, false))
+ SELFPARAM();
+ if(bot_aim(self, 1000000, 0, 1, false))
PHYS_INPUT_BUTTON_ATCK(self) = true;
else
{
}
METHOD(Vortex, wr_setup, void(entity thiswep))
{
+ SELFPARAM();
self.vortex_lasthit = 0;
}
METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
{
+ SELFPARAM();
float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
return ammo_amount;
}
METHOD(Vortex, wr_checkammo2, bool(entity thiswep))
{
+ SELFPARAM();
if(WEP_CVAR(vortex, secondary))
{
// don't allow charging if we don't have enough ammo
}
METHOD(Vortex, wr_resetplayer, void(entity thiswep))
{
+ SELFPARAM();
if (WEP_CVAR(vortex, charge)) {
if (WEP_CVAR_SEC(vortex, chargepool)) {
self.vortex_chargepool_ammo = 1;
}
METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{
- W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
+ SELFPARAM();
+ W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND_RELOAD);
}
METHOD(Vortex, wr_suicidemessage, Notification(entity thiswep))
{
METHOD(Vortex, wr_impacteffect, void(entity thiswep))
{
+ SELFPARAM();
vector org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+ sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
}
METHOD(Vortex, wr_init, void(entity thiswep))
{
// self
void RestoreGame();
+// Called when a client connects to the server
// input:
// time
// self
// parm1..n
void ClientConnect();
+// Called when a client spawns in the server
// input:
// time
// self
// parm1..n
void SetNewParms();
+// Runs every frame
// input:
//
.bool customizeentityforclient();
#undef spawn
#undef setmodel
+#define stuffcmd(cl, ...) MACRO_BEGIN \
+ entity _cl = (cl); \
+ if (IS_REAL_CLIENT(_cl)) stuffcmd(_cl, __VA_ARGS__); \
+MACRO_END
+
#pragma noref 0
#endif
#include <dpdefs/keycodes.qh>
#endif
+#define USING(name, T) typedef T name
+
+#include "bool.qh"
+#include "int.qh"
+
#include "macro.qh"
+#if NDEBUG
+ #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
+#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)); }
+
#include "warpzone/mathlib.qc"
#include "accumulate.qh"
#include "angle.qc"
#include "arraylist.qh"
#include "bits.qh"
-#include "bool.qh"
#include "color.qh"
#include "counting.qh"
#include "cvar.qh"
#include "file.qh"
#include "functional.qh"
#include "i18n.qh"
-#include "int.qh"
#include "iter.qh"
#include "lazy.qh"
#include "linkedlist.qh"
--- /dev/null
+// generated file; do not modify
+#include "angle.qc"
+#include "p2mathlib.qc"
+#include "random.qc"
+#include "sortlist.qc"
+#include "test.qc"
+#include "urllib.qc"
#pragma once
-typedef entity ArrayList;
+USING(ArrayList, entity);
.int al_buf;
.int al_len;
#define QCC_SUPPORT_NIL
#endif
#endif
+
+#ifdef GMQCC
+ #define LABEL(id) :id
+#else
+ #define LABEL(id) id:
+#endif
--- /dev/null
+// generated file; do not modify
+#include "cl_model.qc"
+#include "cl_player.qc"
+#include "interpolate.qc"
+#include "sv_model.qc"
int sf = ReadInt24_t();
// some nice flags for CSQCMODEL_IF and the hooks
- bool isplayer = (this.entnum >= 1 && this.entnum <= maxclients);
+ bool isplayer = ReadByte() || (this.entnum >= 1 && this.entnum <= maxclients);
if (isnew && isplayer)
{
CSQCModel_players[this.entnum - 1] = this;
this.entremove = CSQCModel_remove;
}
bool islocalplayer = (this.entnum == player_localnum + 1);
- noref bool isnolocalplayer = (isplayer && (this.entnum != player_localnum + 1));
+ noref bool isnolocalplayer = (isplayer && !islocalplayer);
this.classname = "csqcmodel";
this.iflags |= IFLAG_ORIGIN; // interpolate origin too
bool CSQCModel_Send(entity to, int sf)
{
+ SELFPARAM();
// some nice flags for CSQCMODEL_IF
- float isplayer = (IS_CLIENT(self));
- float islocalplayer = (self == to);
- float isnolocalplayer = (isplayer && (self != to));
-
- unused_float = isplayer;
- unused_float = islocalplayer;
- unused_float = isnolocalplayer;
+ noref bool isplayer = IS_CLIENT(this);
+ noref bool islocalplayer = (this == to);
+ noref bool isnolocalplayer = (isplayer && (this != to));
WriteHeader(MSG_ENTITY, ENT_CLIENT_MODEL);
WriteInt24_t(MSG_ENTITY, sf);
+ WriteByte(MSG_ENTITY, isplayer);
#define CSQCMODEL_IF(cond) if(cond) {
#define CSQCMODEL_ENDIF }
#define CSQCMODEL_PROPERTY(flag,t,r,w,f) \
if(sf & flag) \
{ \
- w(MSG_ENTITY, self.csqcmodel_##f); \
+ w(MSG_ENTITY, this.csqcmodel_##f); \
}
#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f)
ALLPROPERTIES
void CSQCModel_CheckUpdate(entity e)
{
// some nice flags for CSQCMODEL_IF
- float isplayer = (IS_CLIENT(e));
+ float isplayer = IS_CLIENT(e);
float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
SELFPARAM();
this.think = SUB_Remove_self;
this.nextthink = time;
- WITH(entity, self, this.owner, this.use());
+ WITHSELF(this.owner, this.selfthink(this));
}
-/*
- Execute func() after time + fdelay.
- self when func is executed = self when defer is called
-*/
- void defer(entity this, float fdelay, void() func)
+ /**
+ * Execute func() after time + fdelay.
+ * self when func is executed = self when defer is called
+ */
+ void defer(entity this, float fdelay, void(entity this) func)
{
entity e = new_pure(deferred);
e.owner = this;
- e.use = func;
+ setthink(e, func);
e.think = defer_think;
e.nextthink = time + fdelay;
}
// zero overhead mode, use this for releases
-#define ENUMCLASS(id) typedef int id; enum { CASE(id, Null)
+#define ENUMCLASS(id) USING(id, int); enum { CASE(id, Null)
#define CASE(class, id) class##_##id,
#define ENUMCLASS_END(id) };
#define ORDINAL(it) (it)
#pragma once
+#if 1
+#define ITER_CONST const
+#else
+#define ITER_CONST
+#endif
+
#define FOREACH_ARRAY(arr, start, end, cond, body) \
MACRO_BEGIN \
{ \
for (int _i = start; _i < end; ++_i) \
{ \
const noref int i = _i; \
- const noref entity it = arr[i]; \
+ ITER_CONST noref entity it = arr[i]; \
if (cond) { LAMBDA(body) } \
} \
} MACRO_END
for (entity _it = list##_first; _it; (_it = _it.next, ++_i)) \
{ \
const noref int i = _i; \
- const noref entity it = _it; \
+ ITER_CONST noref entity it = _it; \
if (cond) { LAMBDA(body) } \
} \
} MACRO_END
} MACRO_END
#if defined(CSQC)
+ entity(entity start, .string fld, string match) _findstring = #18;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+ entity(entity start, .entity fld, entity match) _findentity = #98;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findfloat = #98;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findflags = #449;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
#elif defined(SVQC)
+ entity(entity start, .string fld, string match) _findstring = #18;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+ entity(entity start, .entity fld, entity match) _findentity = #98;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findfloat = #98;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findflags = #449;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
#elif defined(MENUQC)
+ entity(entity start, .string fld, string match) _findstring = #24;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #26;
+
+ entity(entity start, .entity fld, entity match) _findentity = #25;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #27;
+
+ entity(entity start, .float fld, float match) _findfloat = #25;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #27;
+
+ entity(entity start, .float fld, float match) _findflags = #87;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #88;
#endif
#define ORDERED(F) F##_UNORDERED
+#define _FOREACH_ENTITY_FIND_ORDERED(T, fld, match, cond, body) \
+ MACRO_BEGIN { \
+ int _i = 0; \
+ for (entity _it = NULL; (_it = _find##T(_it, fld, match)); ++_i) \
+ { \
+ const noref int i = _i; \
+ ITER_CONST noref entity it = _it; \
+ if (cond) LAMBDA(body) \
+ } \
+ } MACRO_END
+#define _FOREACH_ENTITY_FIND_UNORDERED(id, T, fld, match, cond, body) \
+ MACRO_BEGIN { \
+ if (_FOREACH_ENTITY_FIND_##T##_##id##mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FIND_##T##_##id##mutex); \
+ _FOREACH_ENTITY_FIND_##T##_##id##mutex = __FUNC__; \
+ entity _foundchain_first = _findchain##T##_tofield(fld, match, _FOREACH_ENTITY_FIND_##T##_next##id); \
+ FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FIND_##T##_next##id, cond, body); \
+ _FOREACH_ENTITY_FIND_##T##_##id##mutex = string_null; \
+ } MACRO_END
#define FOREACH_ENTITY(cond, body) ORDERED(FOREACH_ENTITY)(cond, body)
#define FOREACH_ENTITY_ORDERED(cond, body) \
for (entity _it = NULL; (_it = nextent(_it)); ++_i) \
{ \
const noref int i = _i; \
- const noref entity it = _it; \
- if (cond) { LAMBDA(body) } \
+ ITER_CONST noref entity it = _it; \
+ if (cond) LAMBDA(body) \
} \
} MACRO_END
/** marker field, always NULL */
.entity _FOREACH_ENTITY_fld;
+.entity _FOREACH_ENTITY_FIND_entity_nextall; noref string _FOREACH_ENTITY_FIND_entity_allmutex;
+#define FOREACH_ENTITY_UNORDERED(cond, body) _FOREACH_ENTITY_FIND_UNORDERED(all, entity, _FOREACH_ENTITY_fld, NULL, cond, body)
-.entity _FOREACH_ENTITY_next;
-noref string _FOREACH_ENTITY_mutex;
-#define FOREACH_ENTITY_UNORDERED(cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_mutex); \
- _FOREACH_ENTITY_mutex = __FUNC__; \
- entity _foundchain_first = _findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_next, cond, body); \
- _FOREACH_ENTITY_mutex = string_null; \
- } MACRO_END
-
+#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
+#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(flags, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_flags_next; noref string _FOREACH_ENTITY_FIND_flags_mutex;
+#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, flags, fld, match, true, body)
#ifndef MENUQC
-entity(vector org, float rad, .entity tofield) _findradius_tofield = #22;
+entity(vector org, float rad, .entity tofield) _findchainradius_tofield = #22;
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body) FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body)
-.entity _FOREACH_ENTITY_RADIUS_next;
-noref string _FOREACH_ENTITY_RADIUS_mutex;
-#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_RADIUS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_RADIUS_mutex); \
- _FOREACH_ENTITY_RADIUS_mutex = __FUNC__; \
- entity _foundchain_first = _findradius_tofield(org, dist, _FOREACH_ENTITY_RADIUS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_RADIUS_next, cond, body); \
- _FOREACH_ENTITY_RADIUS_mutex = string_null; \
- } MACRO_END
+.entity _FOREACH_ENTITY_FIND_radius_next; noref string _FOREACH_ENTITY_FIND_radius_mutex;
+#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(, radius, org, dist, cond, body)
#endif
-
-#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
-#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) FOREACH_ENTITY_ORDERED(it.classname == class && (cond), body)
-.entity _FOREACH_ENTITY_CLASS_next;
-noref string _FOREACH_ENTITY_CLASS_mutex;
-#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_CLASS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_CLASS_mutex); \
- _FOREACH_ENTITY_CLASS_mutex = __FUNC__; \
- entity _foundchain_first = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_CLASS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_CLASS_next, cond, body); \
- _FOREACH_ENTITY_CLASS_mutex = string_null; \
- } MACRO_END
-
-
-
#define FOREACH_ENTITY_FLOAT(fld, match, body) ORDERED(FOREACH_ENTITY_FLOAT)(fld, match, body)
-#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_FLOAT_next;
-noref string _FOREACH_ENTITY_FLOAT_mutex;
-#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_FLOAT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLOAT_mutex); \
- _FOREACH_ENTITY_FLOAT_mutex = __FUNC__; \
- entity _foundchain_first = _findchainfloat_tofield(fld, match, _FOREACH_ENTITY_FLOAT_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLOAT_next, true, body); \
- _FOREACH_ENTITY_FLOAT_mutex = string_null; \
- } MACRO_END
-
-
-
-#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
-#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld & match, body)
-.entity _FOREACH_ENTITY_FLAGS_next;
-noref string _FOREACH_ENTITY_FLAGS_mutex;
-#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_FLAGS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLAGS_mutex); \
- _FOREACH_ENTITY_FLAGS_mutex = __FUNC__; \
- entity _foundchain_first = _findchainflags_tofield(fld, match, _FOREACH_ENTITY_FLAGS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLAGS_next, true, body); \
- _FOREACH_ENTITY_FLAGS_mutex = string_null; \
- } MACRO_END
-
-
+#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(float, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_float_next; noref string _FOREACH_ENTITY_FIND_float_mutex;
+#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, float, fld, match, true, body)
#define FOREACH_ENTITY_ENT(fld, match, body) ORDERED(FOREACH_ENTITY_ENT)(fld, match, body)
-#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_ENT_next;
-noref string _FOREACH_ENTITY_ENT_mutex;
-#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_ENT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_ENT_mutex); \
- _FOREACH_ENTITY_ENT_mutex = __FUNC__; \
- entity _foundchain_first = _findchainentity_tofield(fld, match, _FOREACH_ENTITY_ENT_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_ENT_next, true, body); \
- _FOREACH_ENTITY_ENT_mutex = string_null; \
- } MACRO_END
-
-
+#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(entity, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_entity_next; noref string _FOREACH_ENTITY_FIND_entity_mutex;
+#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, entity, fld, match, true, body)
#define FOREACH_ENTITY_STRING(fld, match, body) ORDERED(FOREACH_ENTITY_STRING)(fld, match, body)
-#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_STRING_next;
-noref string _FOREACH_ENTITY_STRING_mutex;
-#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_STRING_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_STRING_mutex); \
- _FOREACH_ENTITY_STRING_mutex = __FUNC__; \
- entity _foundchain_first = _findchainstring_tofield(fld, match, _FOREACH_ENTITY_STRING_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_STRING_next, true, body); \
- _FOREACH_ENTITY_STRING_mutex = string_null; \
- } MACRO_END
+#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(string, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_string_next; noref string _FOREACH_ENTITY_FIND_string_mutex;
+#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, string, fld, match, true, body)
+
+#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
+#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) _FOREACH_ENTITY_FIND_ORDERED(string, classname, class, cond, body)
+.entity _FOREACH_ENTITY_FIND_string_nextclazz; noref string _FOREACH_ENTITY_FIND_string_clazzmutex;
+#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(clazz, string, classname, class, cond, body)
noref int i = 0; \
for (entity _it = list.ll_head; _it; (_it = _it.ll_next, ++i)) \
{ \
- noref entity it = _it.ll_data; \
+ ITER_CONST noref entity it = _it.ll_data; \
if (cond) { body } \
} \
} MACRO_END
string(string...) strcat0n = #115;
#endif
+#define __SOURCELOC__ (sprintf("^9"__FILE__"^7" ":" "^9%s^7" ":" "^9"STR(__LINE__)"^7", __FUNC__))
+
#define _LOG(f, level, s) \
MACRO_BEGIN { \
- f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [" __FILE__ "^7:^9%s^7:^9" STR(__LINE__) "] \n^7%s\n", __FUNC__, s)); \
+ f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [%s^9]\n^7%s\n", __SOURCELOC__, s)); \
} MACRO_END
#define LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
fclose(fh);
}
-typedef int HashMap;
+USING(HashMap, int);
int db_create()
{
#define REGISTER_NET_LINKED(id) \
[[accumulate]] NET_HANDLE(id, bool isnew) \
{ \
- this = self; \
+ this = __self; \
this.sourceLoc = __FILE__ ":" STR(__LINE__); \
if (!this) isnew = true; \
} \
/** return false to remove from the client */
.bool(entity this, entity to, int sendflags) SendEntity3;
- bool SendEntity_self(entity to, int sendflags) { return self.SendEntity3(self, to, sendflags); }
+ bool SendEntity_self(entity to, int sendflags) { SELFPARAM(); return this.SendEntity3(this, to, sendflags); }
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
{
void UncustomizeEntitiesRun()
{
- FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITH(entity, self, it, it.uncustomizeentityforclient()));
+ FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITHSELF(it, it.uncustomizeentityforclient()));
}
STRING_ITERATOR(g_buf, string_null, 0);
#include "static.qh"
#ifdef MENUQC
- #define NULL (null_entity)
+ #define NULL (0, null_entity)
+ #define world NULL
#else
- #define NULL (world)
+ #define NULL (0, world)
#endif
.vector origin;
.bool pure_data;
-/** @deprecated, use new_pure or NEW(class) */
+/** @deprecated use new_pure or NEW(class) */
#define make_pure(e) \
MACRO_BEGIN \
{ \
#define EVAL_entityclass(...) __VA_ARGS__
#define entityclass_1(name) entityclass_2(name, Object)
#ifndef QCC_SUPPORT_ENTITYCLASS
- #define entityclass_2(name, base) typedef entity name
+ #define entityclass_2(name, base) USING(name, entity)
#define class(name)
#define _new(class, pure) __spawn( #class, __FILE__ ":" STR(__LINE__), pure)
#else
#define new_pure(class) _new(class, true)
#define spawn() __spawn("entity", __FILE__ ":" STR(__LINE__), false)
+#define delete(this) MACRO_BEGIN { \
+ entity _this = (this); \
+ void(entity) _dtor = _this.dtor; \
+ if (_dtor) _dtor(_this); else remove(_this); \
+ /* this = NULL; */ \
+} MACRO_END
+
entity _clearentity_ent;
STATIC_INIT(clearentity)
{
// Classes have a `spawn##cname(entity)` constructor
// The parameter is used across [[accumulate]] functions
+.bool transmute;
+
// Macros to hide this implementation detail:
#ifdef __STDC__
#define NEW(cname, ...) \
OVERLOAD_(spawn##cname, new_pure(cname) P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
+
+ #define _TRANSMUTE(cname, this, ...) \
+ OVERLOAD_(spawn##cname, this P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
+
#define CONSTRUCT(cname, ...) \
OVERLOAD_(spawn##cname, this P99_IF_EMPTY(__VA_ARGS__)()(, __VA_ARGS__))
#else
#define NEW(cname, ...) \
OVERLOAD(spawn##cname, new_pure(cname),##__VA_ARGS__)
+ #define _TRANSMUTE(cname, this, ...) \
+ OVERLOAD(spawn##cname, this,##__VA_ARGS__)
+
#define CONSTRUCT(cname, ...) \
OVERLOAD(spawn##cname, this,##__VA_ARGS__)
#endif
+#define TRANSMUTE(cname, this, ...) MACRO_BEGIN \
+ entity _e = (this); \
+ if (_e.vtblbase != cname##_vtbl) { \
+ _e.transmute = true; \
+ _e.classname = #cname; \
+ _TRANSMUTE(cname, _e, __VA_ARGS__); \
+ } \
+ MACRO_END
+
#define CONSTRUCTOR(cname, ...) \
cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) \
{ \
}
#define VTBL(cname, base) \
- INIT_STATIC(cname); \
+ _INIT_STATIC(cname); \
entity cname##_vtbl; \
void cname##_vtbl_init() \
{ \
} \
ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
-#define INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
+#define _INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
#define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this)
#define CLASS(cname, base) \
entityclass(cname, base); \
- class(cname).bool instanceOf##cname; \
+ class(cname).bool instanceOf##cname; \
+ bool is_##cname(entity e) { return e.instanceOf##cname; } \
+ void isnt_##cname(entity e) { eprint(e); } \
VTBL(cname, base) \
- INIT_STATIC(cname) \
- { \
- if (cname##_vtbl) \
- { \
+ _INIT_STATIC(cname) \
+ { \
+ if (cname##_vtbl && !this.transmute)\
+ { \
copyentity(cname##_vtbl, this); \
return; \
} \
spawn##base##_static(this); \
this.instanceOf##cname = true; \
} \
- INIT(cname) \
- { \
+ INIT(cname) \
+ { \
/* Only statically initialize the current class, it contains everything it inherits */ \
if (cname##_vtbl.vtblname == this.classname) \
- { \
+ { \
spawn##cname##_static(this); \
+ this.transmute = false; \
this.classname = #cname; \
this.vtblname = string_null; \
this.vtblbase = cname##_vtbl; \
#define METHOD(cname, name, prototype) \
STATIC_METHOD(cname, name, prototype); \
class(cname) .prototype name; \
- INIT_STATIC(cname) \
+ _INIT_STATIC(cname) \
{ \
this.name = METHOD_REFERENCE(cname, name); \
} \
STATIC_METHOD(cname, name, prototype)
+#define DESTRUCTOR(cname) \
+ STATIC_METHOD(cname, dtorimpl, void(cname this)); \
+ METHOD(cname, dtor, void(cname this)) \
+ { \
+ METHOD_REFERENCE(cname, dtorimpl)(this); \
+ this.instanceOf##cname = false; \
+ entity super = SUPER(cname); \
+ if (super != cname##_vtbl) super.dtor(this); \
+ } \
+ STATIC_METHOD(cname, dtorimpl, void(cname this))
+
#define ATTRIB(cname, name, type, val) \
class(cname).type name; \
INIT(cname) \
this.name = val; \
}
+#define STATIC_ATTRIB(cname, name, type, val) \
+ type cname##_##name; \
+ _INIT_STATIC(cname) \
+ { \
+ noref bool strzone; /* Error on strzone() calls. */ \
+ cname##_##name = val; \
+ }
+
+// cleanup potentially zoned strings from base classes
+
#define ATTRIB_STRZONE(cname, name, type, val) \
class(cname).type name; \
INIT(cname) \
this.name = strzone(val); \
}
+#define STATIC_ATTRIB_STRZONE(cname, name, type, val) \
+ type cname##_##name; \
+ _INIT_STATIC(cname) \
+ { \
+ if (cname##_##name) \
+ strunzone(cname##_##name); \
+ cname##_##name = val; \
+ }
+
#define ATTRIBARRAY(cname, name, type, cnt) \
class(cname).type name[cnt];
#define spawn_1(this)
#define _vtbl NULL
CLASS(Object, );
- METHOD(Object, describe, string(entity this))
+ DESTRUCTOR(Object) { remove(this); }
+ #define remove(this) delete(this)
+ METHOD(Object, describe, string(Object this))
{
+ TC(Object, this);
string s = _("No description");
if (cvar("developer"))
{
}
return s;
}
- METHOD(Object, display, void(entity this, void(string name, string icon) returns))
+ METHOD(Object, display, void(Object this, void(string name, string icon) returns))
{
+ TC(Object, this);
returns(sprintf("entity %i", this), "nopreview_map");
}
ENDCLASS(Object)
* Must be followed by a semicolon or a function body with a `this` parameter.
* Wrapper macros may perform actions after user initialization like so:
* #define REGISTER_FOO(id) \
- * REGISTER(Foos, FOO, id, m_id, NEW(Foo)); \
- * REGISTER_INIT_POST(FOO, id) { \
+ * REGISTER(Foos, FOO, id, m_id, NEW(Foo)) { \
* print("Registering foo #", this.m_id + 1, "\n"); \
* } \
* REGISTER_INIT(FOO, id)
#define REGISTER_4(registry, id, fld, inst) \
entity id; \
REGISTER_INIT(id) {} \
- REGISTER_INIT_POST(id) {} \
void Register_##id() \
{ \
if (registry##_COUNT >= registry##_MAX) LOG_FATALF("Registry capacity exceeded (%d)", registry##_MAX); \
this.registered_id = #id; \
REGISTRY_PUSH(registry, fld, this); \
Register_##id##_init(this); \
- Register_##id##_init_post(this); \
} \
ACCUMULATE_FUNCTION(_Register##registry, Register_##id) \
REGISTER_INIT(id)
} MACRO_END
#define REGISTER_INIT(id) [[accumulate]] void Register_##id##_init(entity this)
-#define REGISTER_INIT_POST(id) [[accumulate]] void Register_##id##_init_post(entity this)
/** internal next pointer */
#define REGISTRY_NEXT enemy
FOREACH(id, true, s = strcat(s, join, it.registered_id)); \
s = substring(s, strlen(join), -1); \
string h = REGISTRY_HASH(id) = strzone(digest_hex(algo, s)); \
- LOG_TRACEF(#id ": %s\n[%s]\n", h, s); \
+ LOG_DEBUGF(#id ": %s\n[%s]\n", h, s); \
} \
void Registry_check(string r, string sv) \
{ \
// Transition from global 'self' to local 'this'
-[[alias("self")]] entity __self;
-
// Step 1: auto oldself
#if 1
- #define SELFPARAM() noref entity this = __self
- #define setself(s) (__self = s)
- #define self __self
+ #define SELFPARAM() noref const entity this = self
#endif
-// Step 2: check SELFPARAM() is present for functions that use self
-#if 0
- #define SELFPARAM() [[alias("__self")]] noref entity this = __self
- #define setself(s) (__self = s)
- #define self this
+// Step 2: const self
+#if 1
+ #define self (0, self)
+ [[alias("self")]] entity __self;
+ #define setself(s) (__self = s)
+ #define WITHSELF(value, block) WITH(entity, __self, value, (0, block))
+#endif
+
+// Step 3: propagate SELFPARAM()
+#if 1
+ #undef self
+ #define self (this, self)
#endif
-// Step 3: const self
+// Step 4: kill unstructured setself
#if 0
- #define SELFPARAM() noref const entity this = __self
- entity setself(entity e) { return self = e; }
- entity getself() { return self; }
- #define self getself()
+ #undef setself
#endif
-// Step 4: enable when possible
-// TODO: Remove SELFPARAM in favor of a parameter
+// Step 5: this should work
#if 0
- #define SELFPARAM() noref const entity this = __self
- #define self this
+ #define self (0, this)
#endif
+
+// Step 6: Remove SELFPARAM in favor of a parameter
+
+.void(entity this) selftouch;
+void touch_self() { SELFPARAM(); this.selftouch(this); }
+#define settouch(e, f) (e.touch = touch_self, e.selftouch = f)
+
+.void(entity this) selfuse;
+void use_self() { SELFPARAM(); this.selfuse(this); }
+#define setuse(e, f) (e.use = use_self, e.selfuse = f)
+
+.void(entity this) selfthink;
+void think_self() { SELFPARAM(); this.selfthink(this); }
+#define setthink(e, f) (e.think = think_self, e.selfthink = f)
#pragma once
/** is only ever called for i1 < i2 */
-typedef void (int i1, int i2, entity pass) swapfunc_t;
+USING(swapfunc_t, void (int i1, int i2, entity pass));
/** <0 for <, ==0 for ==, >0 for > (like strcmp) */
-typedef int (int i1, int i2, entity pass) comparefunc_t;
+USING(comparefunc_t, int (int i1, int i2, entity pass));
void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
{
void __spawnfunc_##id(entity this); \
[[accumulate]] void spawnfunc_##id(entity this) \
{ \
- if (self == __spawnfunc_expect) \
+ if (__self == __spawnfunc_expect) \
{ \
/* engine call */ \
__spawnfunc_expect = NULL; \
- this = self; \
+ this = __self; \
} \
else \
{ \
#include "sort.qh"
.int m_id;
-typedef vector vectori;
+USING(vectori, vector);
#define REGISTER_STAT(...) EVAL_REGISTER_STAT(OVERLOAD(REGISTER_STAT, __VA_ARGS__))
#define EVAL_REGISTER_STAT(...) __VA_ARGS__
TEST_failed = 0;
TEST_fatal = 0;
TEST_ok = false;
- callfunction(strcat("_TEST_", s));
+ string fn = strcat("_TEST_", s);
+ if (isfunction(fn)) callfunction(fn);
if (TEST_failed > 0)
{
LOG_INFOF("%s: %d items failed.\n", s, TEST_failed);
X(float)
X(entity)
X(string)
-typedef float(...) rawfunc;
+USING(rawfunc, float(...));
X(rawfunc)
#undef X
const float URL_READY_CANWRITE = 1;
const float URL_READY_CANREAD = 2;
// errors: -1, or negative HTTP status code
-typedef void (entity handle, entity pass, float status) url_ready_func;
+USING(url_ready_func, void (entity handle, entity pass, float status));
void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass);
void url_fclose(entity e);
--- /dev/null
+// generated file; do not modify
+#include "anglestransform.qc"
+#include "client.qc"
+#include "common.qc"
+#include "mathlib.qc"
+#include "server.qc"
+#include "util_server.qc"
NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
{
warpzone_warpzones_exist = 1;
- if (!self.enemy)
+ if (!this.enemy)
{
- self.enemy = new(warpzone_from);
+ this.enemy = new(warpzone_from);
}
- self.classname = "trigger_warpzone";
+ this.classname = "trigger_warpzone";
int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
+ this.warpzone_isboxy = (f & 1);
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- self.enemy.oldorigin_x = ReadCoord();
- self.enemy.oldorigin_y = ReadCoord();
- self.enemy.oldorigin_z = ReadCoord();
- self.enemy.avelocity_x = ReadCoord();
- self.enemy.avelocity_y = ReadCoord();
- self.enemy.avelocity_z = ReadCoord();
- self.oldorigin_x = ReadCoord();
- self.oldorigin_y = ReadCoord();
- self.oldorigin_z = ReadCoord();
- self.avelocity_x = ReadCoord();
- self.avelocity_y = ReadCoord();
- self.avelocity_z = ReadCoord();
+ this.origin = '0 0 0';
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ this.enemy.oldorigin_x = ReadCoord();
+ this.enemy.oldorigin_y = ReadCoord();
+ this.enemy.oldorigin_z = ReadCoord();
+ this.enemy.avelocity_x = ReadCoord();
+ this.enemy.avelocity_y = ReadCoord();
+ this.enemy.avelocity_z = ReadCoord();
+ this.oldorigin_x = ReadCoord();
+ this.oldorigin_y = ReadCoord();
+ this.oldorigin_z = ReadCoord();
+ this.avelocity_x = ReadCoord();
+ this.avelocity_y = ReadCoord();
+ this.avelocity_z = ReadCoord();
if(f & 2)
{
- self.warpzone_fadestart = ReadShort();
- self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+ this.warpzone_fadestart = ReadShort();
+ this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
}
else
{
- self.warpzone_fadestart = 0;
- self.warpzone_fadeend = 0;
+ this.warpzone_fadestart = 0;
+ this.warpzone_fadeend = 0;
}
// common stuff
- WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity);
+ WarpZone_SetUp(this, this.enemy.oldorigin, this.enemy.avelocity, this.oldorigin, this.avelocity);
// link me
- //setmodel(self, self.model);
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
+ //setmodel(this, this.model);
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
// how to draw
// engine currently wants this
- setpredraw(self, WarpZone_Fade_PreDraw);
+ setpredraw(this, WarpZone_Fade_PreDraw);
- //self.move_touch = WarpZone_Touch;
+ //this.move_touch = WarpZone_Touch;
return true;
}
NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew)
{
warpzone_cameras_exist = 1;
- self.classname = "func_warpzone_camera";
+ this.classname = "func_warpzone_camera";
int f = ReadByte();
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- self.oldorigin_x = ReadCoord();
- self.oldorigin_y = ReadCoord();
- self.oldorigin_z = ReadCoord();
- self.avelocity_x = ReadCoord();
- self.avelocity_y = ReadCoord();
- self.avelocity_z = ReadCoord();
+ this.origin = '0 0 0';
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ this.oldorigin_x = ReadCoord();
+ this.oldorigin_y = ReadCoord();
+ this.oldorigin_z = ReadCoord();
+ this.avelocity_x = ReadCoord();
+ this.avelocity_y = ReadCoord();
+ this.avelocity_z = ReadCoord();
if(f & 2)
{
- self.warpzone_fadestart = ReadShort();
- self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+ this.warpzone_fadestart = ReadShort();
+ this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
}
else
{
- self.warpzone_fadestart = 0;
- self.warpzone_fadeend = 0;
+ this.warpzone_fadestart = 0;
+ this.warpzone_fadeend = 0;
}
// common stuff
- WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity);
+ WarpZone_Camera_SetUp(this, this.oldorigin, this.avelocity);
// engine currently wants this
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
// link me
- //setmodel(self, self.model);
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
+ //setmodel(this, this.model);
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
// how to draw
// engine currently wants this
- setpredraw(self, WarpZone_Fade_PreDraw);
+ setpredraw(this, WarpZone_Fade_PreDraw);
return true;
}
void CL_RotateMoves(vector ang) = #638;
NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew)
{
- self.classname = "warpzone_teleported";
+ this.classname = "warpzone_teleported";
vector v;
v.x = ReadCoord();
v.y = ReadCoord();
v.z = ReadCoord();
return = true;
if (!isnew) return;
- self.warpzone_transform = v;
- setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, getpropertyvec(VF_CL_VIEWANGLES)));
+ this.warpzone_transform = v;
+ setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(this, getpropertyvec(VF_CL_VIEWANGLES)));
if(checkextension("DP_CSQC_ROTATEMOVES"))
CL_RotateMoves(v);
//CL_RotateMoves('0 90 0');
void WarpZone_FixPMove()
{
- entity e;
- e = WarpZone_Find(pmove_org, pmove_org);
+ entity e = WarpZone_Find(pmove_org, pmove_org);
if(e)
{
pmove_org = WarpZone_TransformOrigin(e, pmove_org);
vector WarpZone_camera_transform(vector org, vector ang)
{SELFPARAM();
vector vf, vr, vu;
- if(self.warpzone_fadestart)
- if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+ if(this.warpzone_fadestart)
+ if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
return org;
// don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
// unneeded on client, on server this helps a lot
vf = v_forward;
vr = v_right;
vu = v_up;
- org = WarpZone_TransformOrigin(self, org);
- vf = WarpZone_TransformVelocity(self, vf);
- vr = WarpZone_TransformVelocity(self, vr);
- vu = WarpZone_TransformVelocity(self, vu);
+ org = WarpZone_TransformOrigin(this, org);
+ vf = WarpZone_TransformVelocity(this, vf);
+ vr = WarpZone_TransformVelocity(this, vr);
+ vu = WarpZone_TransformVelocity(this, vu);
if(autocvar_cl_warpzone_usetrace)
- traceline(self.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
+ traceline(this.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
else
- trace_endpos = self.warpzone_targetorigin;
+ trace_endpos = this.warpzone_targetorigin;
v_forward = vf;
v_right = vr;
v_up = vu;
vector WarpZone_Camera_camera_transform(vector org, vector ang)
{SELFPARAM();
// a fixed camera view
- if(self.warpzone_fadestart)
- if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+ if(this.warpzone_fadestart)
+ if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
return org;
// don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
// unneeded on client, on server this helps a lot
- trace_endpos = self.warpzone_origin;
- makevectors(self.warpzone_angles);
- return self.warpzone_origin;
+ trace_endpos = this.warpzone_origin;
+ makevectors(this.warpzone_angles);
+ return this.warpzone_origin;
}
void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang) // we assume that e.oldorigin and e.avelocity point to view origin and direction
org = trace_endpos;
}
WarpZone_MakeAllOther();
-:fail
+LABEL(fail)
if(contentshack)
BITCLR_ASSIGN(WarpZone_trace_forent.dphitcontentsmask, DPCONTENTS_SOLID);
trace_startsolid = sol;
e.velocity = -e.velocity;
}
WarpZone_MakeAllOther();
-:fail
+LABEL(fail)
WarpZone_tracetoss_velocity = e.velocity;
v_forward = vf;
v_right = vr;
}
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
{
- if (!warpzone_warpzones_exist && !needlineofsight) return findradius(org, rad);
+ // FIXME: why can't we do this? (sometimes finds nothing, breaking explosions)
+ // if (!warpzone_warpzones_exist && !needlineofsight) return findradius(org, rad);
WarpZone_FindRadius_Recurse(org, rad, org, '0 0 0', '0 0 0', needlineofsight);
entity list_first = findchainfloat(WarpZone_findradius_hit, 1);
FOREACH_LIST(list, chain, true, it.WarpZone_findradius_hit = 0);
void WarpZone_RefSys_GC()
{SELFPARAM();
// garbage collect unused reference systems
- self.nextthink = time + 1;
- if(self.owner.WarpZone_refsys != self)
- remove(self);
+ this.nextthink = time + 1;
+ if(this.owner.WarpZone_refsys != this)
+ remove(this);
}
void WarpZone_RefSys_CheckCreate(entity me)
{
float WarpZoneLib_ExactTrigger_Touch()
{SELFPARAM();
- return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, self, other);
+ return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, this, other);
}
#define MOVE_NOTHING -1
entity WarpZone_trace_forent; // temp, callback is allowed to change it
-typedef void(vector start, vector hit, vector end) WarpZone_trace_callback_t; // called on every elementary trace
+USING(WarpZone_trace_callback_t, void(vector start, vector hit, vector end)); // called on every elementary trace
var WarpZone_trace_callback_t WarpZone_trace_callback_t_null;
entity WarpZone_trace_transform; // transform accumulator during a trace
entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
}
#ifdef SVQC
-bool WarpZone_Teleported_Send(entity to, int sf)
-{SELFPARAM();
+bool WarpZone_Teleported_Send(entity this, entity to, int sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
- WriteCoord(MSG_ENTITY, self.angles.x);
- WriteCoord(MSG_ENTITY, self.angles.y);
- WriteCoord(MSG_ENTITY, self.angles.z);
+ WriteCoord(MSG_ENTITY, this.angles.x);
+ WriteCoord(MSG_ENTITY, this.angles.y);
+ WriteCoord(MSG_ENTITY, this.angles.z);
return true;
}
#endif
entity ts = new(warpzone_teleported);
setmodel(ts, MDL_Null);
- ts.SendEntity = WarpZone_Teleported_Send;
+ ts.SendEntity = SendEntity_self;
+ ts.SendEntity3 = WarpZone_Teleported_Send;
ts.SendFlags = 0xFFFFFF;
ts.drawonlytoclient = player;
ts.think = SUB_Remove_self;
return;
#ifdef SVQC
- if(WarpZone_PlaneDist(self, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#elif defined(CSQC)
- if(WarpZone_PlaneDist(self, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#endif
return;
#endif
else
f = -1;
- if(WarpZone_Teleport(self, other, f, 0))
+ if(WarpZone_Teleport(this, other, f, 0))
{
#ifdef SVQC
string save1, save2;
activator = other;
- save1 = self.target; self.target = string_null;
- save2 = self.target3; self.target3 = string_null;
+ save1 = this.target; this.target = string_null;
+ save2 = this.target3; this.target3 = string_null;
SUB_UseTargets();
- if (!self.target) self.target = save1;
- if (!self.target3) self.target3 = save2;
+ if (!this.target) this.target = save1;
+ if (!this.target3) this.target3 = save2;
- setself(self.enemy);
- save1 = self.target; self.target = string_null;
- save2 = self.target2; self.target2 = string_null;
+ setself(this.enemy);
+ save1 = this.target; this.target = string_null;
+ save2 = this.target2; this.target2 = string_null;
SUB_UseTargets();
- if (!self.target) self.target = save1;
- if (!self.target2) self.target2 = save2;
+ if (!this.target) this.target = save1;
+ if (!this.target2) this.target2 = save2;
setself(this);
#endif
}
}
#ifdef SVQC
-bool WarpZone_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Send(entity this, entity to, int sendflags)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE);
// we must send this flag for clientside to match properly too
int f = 0;
- if(self.warpzone_isboxy)
+ if(this.warpzone_isboxy)
BITSET_ASSIGN(f, 1);
- if(self.warpzone_fadestart)
+ if(this.warpzone_fadestart)
BITSET_ASSIGN(f, 2);
- if(self.origin != '0 0 0')
+ if(this.origin != '0 0 0')
BITSET_ASSIGN(f, 4);
WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
if(f & 4)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteCoord(MSG_ENTITY, this.mins.x);
+ WriteCoord(MSG_ENTITY, this.mins.y);
+ WriteCoord(MSG_ENTITY, this.mins.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
// we need THESE to calculate the proper transform
- WriteCoord(MSG_ENTITY, self.warpzone_origin.x);
- WriteCoord(MSG_ENTITY, self.warpzone_origin.y);
- WriteCoord(MSG_ENTITY, self.warpzone_origin.z);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.x);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.y);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.z);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.x);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.y);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.z);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.x);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.y);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.z);
if(f & 2)
{
- WriteShort(MSG_ENTITY, self.warpzone_fadestart);
- WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, this.warpzone_fadeend);
}
return true;
}
-bool WarpZone_Camera_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Camera_Send(entity this, entity to, int sendflags)
+{
int f = 0;
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
- if(self.warpzone_fadestart)
+ if(this.warpzone_fadestart)
BITSET_ASSIGN(f, 2);
- if(self.origin != '0 0 0')
+ if(this.origin != '0 0 0')
BITSET_ASSIGN(f, 4);
WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
if(f & 4)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteCoord(MSG_ENTITY, this.mins.x);
+ WriteCoord(MSG_ENTITY, this.mins.y);
+ WriteCoord(MSG_ENTITY, this.mins.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
// we need THESE to calculate the proper transform
- WriteCoord(MSG_ENTITY, self.enemy.origin.x);
- WriteCoord(MSG_ENTITY, self.enemy.origin.y);
- WriteCoord(MSG_ENTITY, self.enemy.origin.z);
- WriteCoord(MSG_ENTITY, self.enemy.angles.x);
- WriteCoord(MSG_ENTITY, self.enemy.angles.y);
- WriteCoord(MSG_ENTITY, self.enemy.angles.z);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.x);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.y);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.z);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.x);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.y);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.z);
if(f & 2)
{
- WriteShort(MSG_ENTITY, self.warpzone_fadestart);
- WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, this.warpzone_fadeend);
}
return true;
// engine now aborts moves on teleport, so this SHOULD not happen any more
// but if this is called from TouchAreaGrid of the projectile moving,
// then this won't do
- if(time == self.warpzone_teleport_time)
+ if(time == this.warpzone_teleport_time)
return true;
#ifdef SVQC
save_inopen = trace_inopen;
save_inwater = trace_inwater;
float f;
- if((f = WarpZone_CheckProjectileImpact(self)) != 0)
+ if((f = WarpZone_CheckProjectileImpact(this)) != 0)
return (f > 0);
trace_dpstartcontents = save_dpstartcontents;
trace_dphitcontents = save_dphitcontents;
#ifdef SVQC
-void WarpZone_InitStep_FindOriginTarget()
-{SELFPARAM();
- if(self.killtarget != "")
+void WarpZone_InitStep_FindOriginTarget(entity this)
+{
+ if(this.killtarget != "")
{
- self.aiment = find(world, targetname, self.killtarget);
- if(self.aiment == world)
+ this.aiment = find(world, targetname, this.killtarget);
+ if(this.aiment == world)
{
error("Warp zone with nonexisting killtarget");
return;
}
- self.killtarget = string_null;
+ this.killtarget = string_null;
}
}
-void WarpZonePosition_InitStep_FindTarget()
-{SELFPARAM();
- if(self.target == "")
+void WarpZonePosition_InitStep_FindTarget(entity this)
+{
+ if(this.target == "")
{
error("Warp zone position with no target");
return;
}
- self.enemy = find(world, targetname, self.target);
- if(self.enemy == world)
+ this.enemy = find(world, targetname, this.target);
+ if(this.enemy == world)
{
error("Warp zone position with nonexisting target");
return;
}
- if(self.enemy.aiment)
+ if(this.enemy.aiment)
{
// already is positioned
error("Warp zone position targeting already oriented warpzone");
return;
}
- self.enemy.aiment = self;
+ this.enemy.aiment = this;
}
void WarpZoneCamera_Think()
{SELFPARAM();
- if(self.warpzone_save_origin != self.origin
- || self.warpzone_save_angles != self.angles
- || self.warpzone_save_eorigin != self.enemy.origin
- || self.warpzone_save_eangles != self.enemy.angles)
+ if(this.warpzone_save_origin != this.origin
+ || this.warpzone_save_angles != this.angles
+ || this.warpzone_save_eorigin != this.enemy.origin
+ || this.warpzone_save_eangles != this.enemy.angles)
{
- WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
- self.warpzone_save_origin = self.origin;
- self.warpzone_save_angles = self.angles;
- self.warpzone_save_eorigin = self.enemy.origin;
- self.warpzone_save_eangles = self.enemy.angles;
+ WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+ this.warpzone_save_origin = this.origin;
+ this.warpzone_save_angles = this.angles;
+ this.warpzone_save_eorigin = this.enemy.origin;
+ this.warpzone_save_eangles = this.enemy.angles;
}
- self.nextthink = time;
+ this.nextthink = time;
}
-void WarpZoneCamera_InitStep_FindTarget()
-{SELFPARAM();
+void WarpZoneCamera_InitStep_FindTarget(entity this)
+{
entity e;
float i;
- if(self.target == "")
+ if(this.target == "")
{
error("Camera with no target");
return;
}
- self.enemy = world;
- for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+ this.enemy = world;
+ for(e = world, i = 0; (e = find(e, targetname, this.target)); )
if(random() * ++i < 1)
- self.enemy = e;
- if(self.enemy == world)
+ this.enemy = e;
+ if(this.enemy == world)
{
error("Camera with nonexisting target");
return;
}
warpzone_cameras_exist = 1;
- WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
- self.SendFlags = 0xFFFFFF;
- if(self.spawnflags & 1)
+ WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+ this.SendFlags = 0xFFFFFF;
+ if(this.spawnflags & 1)
{
- self.think = WarpZoneCamera_Think;
- self.nextthink = time;
+ this.think = WarpZoneCamera_Think;
+ this.nextthink = time;
}
else
- self.nextthink = 0;
+ this.nextthink = 0;
}
-void WarpZone_InitStep_UpdateTransform()
-{SELFPARAM();
+void WarpZone_InitStep_UpdateTransform(entity this)
+{
vector org, ang, norm, point;
float area;
vector tri, a, b, c, n;
float i_s, i_t, n_t;
string tex;
- org = self.origin;
+ org = this.origin;
if(org == '0 0 0')
- org = 0.5 * (self.mins + self.maxs);
+ org = 0.5 * (this.mins + this.maxs);
norm = point = '0 0 0';
area = 0;
for(i_s = 0; ; ++i_s)
{
- tex = getsurfacetexture(self, i_s);
+ tex = getsurfacetexture(this, i_s);
if (!tex)
break; // this is beyond the last one
if(tex == "textures/common/trigger" || tex == "trigger")
continue;
- n_t = getsurfacenumtriangles(self, i_s);
+ n_t = getsurfacenumtriangles(this, i_s);
for(i_t = 0; i_t < n_t; ++i_t)
{
- tri = getsurfacetriangle(self, i_s, i_t);
- a = getsurfacepoint(self, i_s, tri.x);
- b = getsurfacepoint(self, i_s, tri.y);
- c = getsurfacepoint(self, i_s, tri.z);
+ tri = getsurfacetriangle(this, i_s, i_t);
+ a = getsurfacepoint(this, i_s, tri.x);
+ b = getsurfacepoint(this, i_s, tri.y);
+ c = getsurfacepoint(this, i_s, tri.z);
n = cross(c - a, b - a);
area = area + vlen(n);
norm = norm + n;
point = point * (1 / (3 * area));
if(vdist(norm, <, 0.99))
{
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " is nonplanar. BEWARE.\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.\n");
area = 0; // no autofixing in this case
}
norm = normalize(norm);
}
ang = '0 0 0';
- if(self.aiment)
+ if(this.aiment)
{
- org = self.aiment.origin;
- ang = self.aiment.angles;
+ org = this.aiment.origin;
+ ang = this.aiment.angles;
if(area > 0)
{
org = org - ((org - point) * norm) * norm; // project to plane
makevectors(ang);
if(norm * v_forward < 0)
{
- LOG_INFO("Position target of trigger_warpzone near ", vtos(self.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
+ LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
norm = -1 * norm;
}
ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
ang.x = -ang.x;
if(norm * v_forward < 0.99)
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
- if(vdist(org - self.aiment.origin, >, 0.5))
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been moved to match the plane (", vtos(self.aiment.origin), " -> ", vtos(org), ").\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang), "\n");
+ if(vdist(org - this.aiment.origin, >, 0.5))
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").\n");
}
}
else if(area > 0)
else
error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
- self.warpzone_origin = org;
- self.warpzone_angles = ang;
+ this.warpzone_origin = org;
+ this.warpzone_angles = ang;
}
-void WarpZone_InitStep_ClearTarget()
-{SELFPARAM();
- if(self.enemy)
- self.enemy.enemy = world;
- self.enemy = world;
+void WarpZone_InitStep_ClearTarget(entity this)
+{
+ if(this.enemy)
+ this.enemy.enemy = world;
+ this.enemy = world;
}
entity warpzone_first; .entity warpzone_next;
-void WarpZone_InitStep_FindTarget()
-{SELFPARAM();
+void WarpZone_InitStep_FindTarget(entity this)
+{
float i;
entity e, e2;
- if(self.enemy)
+ if(this.enemy)
return;
// this way only one of the two ents needs to target
- if(self.target != "")
+ if(this.target != "")
{
- self.enemy = self; // so the if(!e.enemy) check also skips self, saves one IF
+ this.enemy = this; // so the if(!e.enemy) check also skips this, saves one IF
e2 = world;
- for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+ for(e = world, i = 0; (e = find(e, targetname, this.target)); )
if(!e.enemy)
- if(e.classname == self.classname) // possibly non-warpzones may use the same targetname!
+ if(e.classname == this.classname) // possibly non-warpzones may use the same targetname!
if(random() * ++i < 1)
e2 = e;
if(!e2)
{
- self.enemy = world;
+ this.enemy = world;
error("Warpzone with non-existing target");
return;
}
- self.enemy = e2;
- e2.enemy = self;
+ this.enemy = e2;
+ e2.enemy = this;
}
}
void WarpZone_Think();
-void WarpZone_InitStep_FinalizeTransform()
-{SELFPARAM();
- if(!self.enemy || self.enemy.enemy != self)
+void WarpZone_InitStep_FinalizeTransform(entity this)
+{
+ if(!this.enemy || this.enemy.enemy != this)
{
error("Invalid warp zone detected. Killed.");
return;
}
warpzone_warpzones_exist = 1;
- WarpZone_SetUp(self, self.warpzone_origin, self.warpzone_angles, self.enemy.warpzone_origin, self.enemy.warpzone_angles);
- self.touch = WarpZone_Touch;
- self.SendFlags = 0xFFFFFF;
- if(self.spawnflags & 1)
+ WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
+ this.touch = WarpZone_Touch;
+ this.SendFlags = 0xFFFFFF;
+ if(this.spawnflags & 1)
{
- self.think = WarpZone_Think;
- self.nextthink = time;
+ this.think = WarpZone_Think;
+ this.nextthink = time;
}
else
- self.nextthink = 0;
+ this.nextthink = 0;
}
float warpzone_initialized;
spawnfunc(misc_warpzone_position)
{
// "target", "angles", "origin"
- self.warpzone_next = warpzone_position_first;
- warpzone_position_first = self;
+ this.warpzone_next = warpzone_position_first;
+ warpzone_position_first = this;
}
spawnfunc(trigger_warpzone_position)
{
// the map, with another killtarget to designate its
// orientation
- if(!self.scale)
- self.scale = self.modelscale;
- if(!self.scale)
- self.scale = 1;
+ if(!this.scale)
+ this.scale = this.modelscale;
+ if(!this.scale)
+ this.scale = 1;
string m;
- m = self.model;
+ m = this.model;
WarpZoneLib_ExactTrigger_Init();
if(m != "")
{
precache_model(m);
- _setmodel(self, m); // no precision needed
+ _setmodel(this, m); // no precision needed
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- self.SendEntity = WarpZone_Send;
- self.SendFlags = 0xFFFFFF;
- BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
- self.warpzone_next = warpzone_first;
- warpzone_first = self;
+ setsize(this, this.mins, this.maxs);
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = WarpZone_Send;
+ this.SendFlags = 0xFFFFFF;
+ BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
+ this.warpzone_next = warpzone_first;
+ warpzone_first = this;
}
spawnfunc(func_camera)
{
- if(!self.scale)
- self.scale = self.modelscale;
- if(!self.scale)
- self.scale = 1;
- if(self.model != "")
+ if(!this.scale)
+ this.scale = this.modelscale;
+ if(!this.scale)
+ this.scale = 1;
+ if(this.model != "")
{
- precache_model(self.model);
- _setmodel(self, self.model); // no precision needed
+ precache_model(this.model);
+ _setmodel(this, this.model); // no precision needed
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- if(!self.solid)
- self.solid = SOLID_BSP;
- else if(self.solid < 0)
- self.solid = SOLID_NOT;
- self.SendEntity = WarpZone_Camera_Send;
- self.SendFlags = 0xFFFFFF;
- self.warpzone_next = warpzone_camera_first;
- warpzone_camera_first = self;
+ setsize(this, this.mins, this.maxs);
+ if(!this.solid)
+ this.solid = SOLID_BSP;
+ else if(this.solid < 0)
+ this.solid = SOLID_NOT;
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = WarpZone_Camera_Send;
+ this.SendFlags = 0xFFFFFF;
+ this.warpzone_next = warpzone_camera_first;
+ warpzone_camera_first = this;
}
void WarpZones_Reconnect()
-{SELFPARAM();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_ClearTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_FindTarget();
- for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
- WarpZoneCamera_InitStep_FindTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_FinalizeTransform();
- setself(this);
+{
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_ClearTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_FindTarget(e);
+ for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+ WarpZoneCamera_InitStep_FindTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_FinalizeTransform(e);
}
void WarpZone_Think()
{SELFPARAM();
- if(self.warpzone_save_origin != self.origin
- || self.warpzone_save_angles != self.angles
- || self.warpzone_save_eorigin != self.enemy.origin
- || self.warpzone_save_eangles != self.enemy.angles)
+ if(this.warpzone_save_origin != this.origin
+ || this.warpzone_save_angles != this.angles
+ || this.warpzone_save_eorigin != this.enemy.origin
+ || this.warpzone_save_eangles != this.enemy.angles)
{
- WarpZone_InitStep_UpdateTransform();
- setself(self.enemy);
- WarpZone_InitStep_UpdateTransform();
- setself(this);
- WarpZone_InitStep_FinalizeTransform();
- setself(self.enemy);
- WarpZone_InitStep_FinalizeTransform();
- setself(this);
- self.warpzone_save_origin = self.origin;
- self.warpzone_save_angles = self.angles;
- self.warpzone_save_eorigin = self.enemy.origin;
- self.warpzone_save_eangles = self.enemy.angles;
- }
- self.nextthink = time;
+ WarpZone_InitStep_UpdateTransform(this);
+ WarpZone_InitStep_UpdateTransform(this.enemy);
+ WarpZone_InitStep_FinalizeTransform(this);
+ WarpZone_InitStep_FinalizeTransform(this.enemy);
+ this.warpzone_save_origin = this.origin;
+ this.warpzone_save_angles = this.angles;
+ this.warpzone_save_eorigin = this.enemy.origin;
+ this.warpzone_save_eangles = this.enemy.angles;
+ }
+ this.nextthink = time;
}
void WarpZone_StartFrame()
if (!warpzone_initialized)
{
warpzone_initialized = true;
- for (setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_FindOriginTarget();
- for (setself(warpzone_position_first); self; setself(self.warpzone_next))
- WarpZonePosition_InitStep_FindTarget();
- for (setself(warpzone_first); self; setself(self.warpzone_next))
- WarpZone_InitStep_UpdateTransform();
- setself(this);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_FindOriginTarget(e);
+ for(entity e = warpzone_position_first; e; e = e.warpzone_next)
+ WarpZonePosition_InitStep_FindTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ WarpZone_InitStep_UpdateTransform(e);
WarpZones_Reconnect();
WarpZone_PostInitialize_Callback();
}
entity oldother = other;
- FOREACH_ENTITY(true,
+ FOREACH_ENTITY(!is_pure(it),
{
if(warpzone_warpzones_exist)
WarpZone_StoreProjectileData(it);
- if((IS_OBSERVER(it) || it.solid == SOLID_NOT))
+ if(IS_OBSERVER(it) || it.solid == SOLID_NOT)
if(IS_CLIENT(it)) // we don't care about it being a bot
{
other = it; // player
}
// teleporters
- setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
- if (self)
- if (!WarpZoneLib_ExactTrigger_Touch())
- Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+ if(other.teleportable)
+ {
+ setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
+ if (self)
+ if (!WarpZoneLib_ExactTrigger_Touch())
+ Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+ }
}
});
setself(this);
}
void trigger_warpzone_reconnect_use()
{SELFPARAM();
- entity e;
- e = self;
// NOTE: this matches for target, not targetname, but of course
// targetname must be set too on the other entities
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && (visible_to_some_client(self) || visible_to_some_client(self.enemy))));
- for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
- self.warpzone_reconnecting = ((e.target == "" || self.target == e.target) && !((e.spawnflags & 1) && visible_to_some_client(self)));
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting)
- WarpZone_InitStep_ClearTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting)
- WarpZone_InitStep_FindTarget();
- for(setself(warpzone_camera_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting)
- WarpZoneCamera_InitStep_FindTarget();
- for(setself(warpzone_first); self; setself(self.warpzone_next))
- if(self.warpzone_reconnecting || self.enemy.warpzone_reconnecting)
- WarpZone_InitStep_FinalizeTransform();
- setself(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ e.warpzone_reconnecting = ((this.target == "" || e.target == this.target) && !((this.spawnflags & 1) && (visible_to_some_client(e) || visible_to_some_client(e.enemy))));
+ for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+ e.warpzone_reconnecting = ((this.target == "" || e.target == this.target) && !((this.spawnflags & 1) && visible_to_some_client(e)));
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting)
+ WarpZone_InitStep_ClearTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting)
+ WarpZone_InitStep_FindTarget(e);
+ for(entity e = warpzone_camera_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting)
+ WarpZoneCamera_InitStep_FindTarget(e);
+ for(entity e = warpzone_first; e; e = e.warpzone_next)
+ if(e.warpzone_reconnecting || e.enemy.warpzone_reconnecting)
+ WarpZone_InitStep_FinalizeTransform(e);
}
spawnfunc(trigger_warpzone_reconnect)
{
- self.use = trigger_warpzone_reconnect_use;
+ this.use = trigger_warpzone_reconnect_use;
}
spawnfunc(target_warpzone_reconnect)
spawnfunc_trigger_warpzone_reconnect(this); // both names make sense here :(
}
-void WarpZone_PlayerPhysics_FixVAngle()
-{SELFPARAM();
+void WarpZone_PlayerPhysics_FixVAngle(entity this)
+{
#ifndef WARPZONE_DONT_FIX_VANGLE
- if(IS_REAL_CLIENT(self))
- if(self.v_angle.z <= 360) // if not already adjusted
- if(time - self.ping * 0.001 < self.warpzone_teleport_time)
+ if(IS_REAL_CLIENT(this))
+ if(this.v_angle.z <= 360) // if not already adjusted
+ if(time - this.ping * 0.001 < this.warpzone_teleport_time)
{
- self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle);
- self.v_angle_z += 720; // mark as adjusted
+ this.v_angle = WarpZone_TransformVAngles(this.warpzone_teleport_zone, this.v_angle);
+ this.v_angle_z += 720; // mark as adjusted
}
#endif
}
//const float ENT_CLIENT_WARPZONE;
//const float ENT_CLIENT_WARPZONE_CAMERA;
-void WarpZone_PlayerPhysics_FixVAngle();
+void WarpZone_PlayerPhysics_FixVAngle(entity this);
void WarpZone_PostInitialize_Callback();
#endif
void WarpZoneLib_ExactTrigger_Init()
{SELFPARAM();
vector mi, ma;
- if (self.movedir == '0 0 0')
- if (self.angles != '0 0 0')
+ if (this.movedir == '0 0 0')
+ if (this.angles != '0 0 0')
{
- makevectors (self.angles);
- self.movedir = v_forward;
+ makevectors (this.angles);
+ this.movedir = v_forward;
}
- if(self.model == "")
+ if(this.model == "")
{
// It's a box! No need to match with exacttriggers.
- self.warpzone_isboxy = 1;
+ this.warpzone_isboxy = 1;
}
else
{
- mi = self.mins;
- ma = self.maxs;
- precache_model(self.model);
- _setmodel(self, self.model);
+ mi = this.mins;
+ ma = this.maxs;
+ precache_model(this.model);
+ _setmodel(this, this.model);
// let mapper-set mins/maxs override the model's bounds if set
if(mi != '0 0 0' || ma != '0 0 0')
{
// It's a box! No need to match with exacttriggers.
- self.mins = mi;
- self.maxs = ma;
- self.warpzone_isboxy = 1;
+ this.mins = mi;
+ this.maxs = ma;
+ this.warpzone_isboxy = 1;
}
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_TRIGGER;
- self.model = "";
+ setsize(this, this.mins, this.maxs);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_TRIGGER;
+ this.model = "";
}
-#ifndef MENU_ALL_H
-#define MENU_ALL_H
+#pragma once
#include "draw.qh"
#include "xonotic/util.qh"
-
-#endif
+#include "menu.qh"
--- /dev/null
+// generated file; do not modify
+#include "draw.qc"
+#include "item.qc"
+#include "menu.qc"
--- /dev/null
+// generated file; do not modify
+#include "animation.qc"
+#include "animhost.qc"
+#include "easing.qc"
+#include "keyframe.qc"
-#ifndef ANIM_ANIMATION_H
- #define ANIM_ANIMATION_H
- CLASS(Animation, Object)
- METHOD(Animation, configureAnimation, void(entity, entity, void(entity, float), float, float, float, float));
- METHOD(Animation, update, void(entity, float, float, float));
- METHOD(Animation, setTimeStartEnd, void(entity, float, float));
- METHOD(Animation, setTimeStartDuration, void(entity, float, float));
- METHOD(Animation, setValueStartEnd, void(entity, float, float));
- METHOD(Animation, setValueStartDelta, void(entity, float, float));
- METHOD(Animation, setObjectSetter, void(entity, entity, void(entity, float)));
- METHOD(Animation, tick, void(entity, float));
- METHOD(Animation, calcValue, float(entity, float, float, float, float));
- METHOD(Animation, isStopped, float(entity));
- METHOD(Animation, stopAnim, void(entity));
- METHOD(Animation, resumeAnim, void(entity));
- METHOD(Animation, isFinished, float(entity));
- METHOD(Animation, finishAnim, void(entity));
- ATTRIB(Animation, object, entity, NULL)
- void setterDummy(entity, float) {}
- ATTRIB(Animation, setter, void(entity, float), setterDummy)
- ATTRIB(Animation, value, float, 0)
- ATTRIB(Animation, startTime, float, 0)
- ATTRIB(Animation, duration, float, 0)
- ATTRIB(Animation, startValue, float, 0)
- ATTRIB(Animation, delta, float, 0)
- ATTRIB(Animation, stopped, float, false)
- ATTRIB(Animation, finished, float, false)
- ENDCLASS(Animation)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "animation.qh"
+
+#include "../menu.qh"
+
METHOD(Animation, configureAnimation, void(entity this, entity obj, void(entity, float) objSetter, float animStartTime, float animDuration, float animStartValue, float animEndValue))
{
this.setObjectSetter(this, obj, objSetter);
this.finished = true;
this.setter(this.object, this.value);
}
-
-#endif
--- /dev/null
+#pragma once
+
+CLASS(Animation, Object)
+ METHOD(Animation, configureAnimation, void(Animation this, entity, void(entity, float), float, float, float, float));
+ METHOD(Animation, update, void(Animation this, float, float, float));
+ METHOD(Animation, setTimeStartEnd, void(Animation this, float, float));
+ METHOD(Animation, setTimeStartDuration, void(Animation this, float, float));
+ METHOD(Animation, setValueStartEnd, void(Animation this, float, float));
+ METHOD(Animation, setValueStartDelta, void(Animation this, float, float));
+ METHOD(Animation, setObjectSetter, void(Animation this, entity, void(entity, float)));
+ METHOD(Animation, tick, void(Animation this, float));
+ METHOD(Animation, calcValue, float(Animation this, float, float, float, float));
+ METHOD(Animation, isStopped, float(Animation this));
+ METHOD(Animation, stopAnim, void(Animation this));
+ METHOD(Animation, resumeAnim, void(Animation this));
+ METHOD(Animation, isFinished, float(Animation this));
+ METHOD(Animation, finishAnim, void(Animation this));
+ ATTRIB(Animation, object, entity, NULL)
+ void setterDummy(Animation this, float) {}
+ ATTRIB(Animation, setter, void(Animation this, float), setterDummy)
+ ATTRIB(Animation, value, float, 0)
+ ATTRIB(Animation, startTime, float, 0)
+ ATTRIB(Animation, duration, float, 0)
+ ATTRIB(Animation, startValue, float, 0)
+ ATTRIB(Animation, delta, float, 0)
+ ATTRIB(Animation, stopped, float, false)
+ ATTRIB(Animation, finished, float, false)
+ENDCLASS(Animation)
+#include "animhost.qh"
+
#include "../menu.qh"
-#ifndef ANIM_ANIMHOST_H
- #define ANIM_ANIMHOST_H
- CLASS(AnimHost, Object)
- METHOD(AnimHost, addAnim, void(entity, entity));
- METHOD(AnimHost, removeAnim, void(entity, entity));
- METHOD(AnimHost, removeAllAnim, void(entity));
- METHOD(AnimHost, removeObjAnim, void(entity, entity));
- METHOD(AnimHost, stopAllAnim, void(entity));
- METHOD(AnimHost, stopObjAnim, void(entity, entity));
- METHOD(AnimHost, resumeAllAnim, void(entity));
- METHOD(AnimHost, resumeObjAnim, void(entity, entity));
- METHOD(AnimHost, finishAllAnim, void(entity));
- METHOD(AnimHost, finishObjAnim, void(entity, entity));
- METHOD(AnimHost, tickAll, void(entity));
- ATTRIB(AnimHost, firstChild, entity, NULL)
- ATTRIB(AnimHost, lastChild, entity, NULL)
- ENDCLASS(AnimHost)
- .entity nextSibling;
- .entity prevSibling;
-#endif
-
-#ifdef IMPLEMENTATION
+#include "animation.qh"
+
+ .entity parent;
METHOD(AnimHost, addAnim, void(entity this, entity other))
{
if (other.parent) error("Can't add already added anim!");
}
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/container.qh"
+
+CLASS(AnimHost, Object)
+ METHOD(AnimHost, addAnim, void(entity, entity));
+ METHOD(AnimHost, removeAnim, void(entity, entity));
+ METHOD(AnimHost, removeAllAnim, void(entity));
+ METHOD(AnimHost, removeObjAnim, void(entity, entity));
+ METHOD(AnimHost, stopAllAnim, void(entity));
+ METHOD(AnimHost, stopObjAnim, void(entity, entity));
+ METHOD(AnimHost, resumeAllAnim, void(entity));
+ METHOD(AnimHost, resumeObjAnim, void(entity, entity));
+ METHOD(AnimHost, finishAllAnim, void(entity));
+ METHOD(AnimHost, finishObjAnim, void(entity, entity));
+ METHOD(AnimHost, tickAll, void(entity));
+ ATTRIB(AnimHost, firstChild, entity, NULL)
+ ATTRIB(AnimHost, lastChild, entity, NULL)
+ENDCLASS(AnimHost)
-#ifndef ANIM_EASING_H
- #define ANIM_EASING_H
- #include "animation.qc"
- entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
- entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
- float easingLinear(float, float, float, float);
- float easingQuadIn(float, float, float, float);
- float easingQuadOut(float, float, float, float);
- float easingQuadInOut(float, float, float, float);
- CLASS(Easing, Animation)
- METHOD(Easing, calcValue, float(entity, float, float, float, float));
- METHOD(Easing, setMath, void(entity, float(float, float, float, float)));
- ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
- ENDCLASS(Easing)
-#endif
+#include "easing.qh"
+
+#include "../menu.qh"
+#include "keyframe.qh"
-#ifdef IMPLEMENTATION
entity makeHostedEasing(entity obj, void(entity, float) objSetter, float(float, float, float, float) func, float animDuration, float animStartValue, float animEnd)
{
entity this = makeEasing(obj, objSetter, func, time, animDuration, animStartValue, animEnd);
if (tickTime < (animDuration / 2)) return easingQuadIn(tickTime, (animDuration / 2), animStart, (animDelta / 2));
else return easingQuadOut((tickTime - (animDuration / 2)), (animDuration / 2), (animStart + (animDelta / 2)), (animDelta / 2));
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "animation.qh"
+entity makeHostedEasing(entity, void(entity, float), float(float, float, float, float), float, float, float);
+entity makeEasing(entity, void(entity, float), float(float, float, float, float), float, float, float, float);
+float easingLinear(float, float, float, float);
+float easingQuadIn(float, float, float, float);
+float easingQuadOut(float, float, float, float);
+float easingQuadInOut(float, float, float, float);
+CLASS(Easing, Animation)
+ METHOD(Easing, calcValue, float(entity, float, float, float, float));
+ METHOD(Easing, setMath, void(entity, float(float, float, float, float)));
+ ATTRIB(Easing, math, float(float, float, float, float), easingLinear)
+ENDCLASS(Easing)
-#ifndef ANIM_KEYFRAME_H
- #define ANIM_KEYFRAME_H
- #include "animation.qc"
- CLASS(Keyframe, Animation)
- METHOD(Keyframe, addEasing, entity(entity, float, float, float(float, float, float, float)));
- METHOD(Keyframe, addAnim, void(entity, entity));
- METHOD(Keyframe, calcValue, float(entity, float, float, float, float));
- ATTRIB(Keyframe, currentChild, entity, NULL)
- ATTRIB(Keyframe, firstChild, entity, NULL)
- ATTRIB(Keyframe, lastChild, entity, NULL)
- ENDCLASS(Keyframe)
- entity makeHostedKeyframe(entity, void(entity, float), float, float, float);
- entity makeKeyframe(entity, void(entity, float), float, float, float);
- float getNewChildStart(entity);
- float getNewChildDuration(entity, float);
- float getNewChildValue(entity);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "keyframe.qh"
+
+#include "../menu.qh"
+#include "easing.qh"
+
+#include "../item/container.qh"
+
+.entity parent;
+
entity makeHostedKeyframe(entity obj, void(entity, float) objSetter, float animDuration, float animStart, float animEnd)
{
entity this = makeKeyframe(obj, objSetter, animDuration, animStart, animEnd);
return animStartValue + animDelta;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "animation.qh"
+CLASS(Keyframe, Animation)
+ METHOD(Keyframe, addEasing, entity(entity, float, float, float(float, float, float, float)));
+ METHOD(Keyframe, addAnim, void(entity, entity));
+ METHOD(Keyframe, calcValue, float(entity, float, float, float, float));
+ ATTRIB(Keyframe, currentChild, entity, NULL)
+ ATTRIB(Keyframe, firstChild, entity, NULL)
+ ATTRIB(Keyframe, lastChild, entity, NULL)
+ENDCLASS(Keyframe)
+entity makeHostedKeyframe(entity, void(entity, float), float, float, float);
+entity makeKeyframe(entity, void(entity, float), float, float, float);
+float getNewChildStart(entity);
+float getNewChildDuration(entity, float);
+float getNewChildValue(entity);
-#include "anim/animation.qc"
-#include "anim/animhost.qc"
-#include "anim/easing.qc"
-#include "anim/keyframe.qc"
-#include "item.qc"
-#include "item/borderimage.qc"
-#include "item/button.qc"
-#include "item/checkbox.qc"
-#include "item/container.qc"
-#include "item/dialog.qc"
-#include "item/image.qc"
-#include "item/inputbox.qc"
-#include "item/inputcontainer.qc"
-#include "item/label.qc"
-#include "item/listbox.qc"
-#include "item/modalcontroller.qc"
-#include "item/nexposee.qc"
-#include "item/radiobutton.qc"
-#include "item/slider.qc"
-#include "item/tab.qc"
-#include "item/textslider.qc"
-
-#include "xonotic/bigbutton.qc"
-#include "xonotic/bigcommandbutton.qc"
-#include "xonotic/button.qc"
-#include "xonotic/campaign.qc"
-#include "xonotic/charmap.qc"
-#include "xonotic/checkbox.qc"
-#include "xonotic/checkbox_slider_invalid.qc"
-#include "xonotic/checkbox_string.qc"
-#include "xonotic/colorbutton.qc"
-#include "xonotic/colorpicker.qc"
-#include "xonotic/colorpicker_string.qc"
-#include "xonotic/commandbutton.qc"
-#include "xonotic/credits.qc"
-#include "xonotic/crosshairpicker.qc"
-#include "xonotic/crosshairpreview.qc"
-#include "xonotic/cvarlist.qc"
-#include "xonotic/datasource.qc"
-#include "xonotic/demolist.qc"
-#include "xonotic/dialog.qc"
-#include "xonotic/dialog_credits.qc"
-#include "xonotic/dialog_firstrun.qc"
-#include "xonotic/dialog_hudpanel_ammo.qc"
-#include "xonotic/dialog_hudpanel_centerprint.qc"
-#include "xonotic/dialog_hudpanel_chat.qc"
-#include "xonotic/dialog_hudpanel_engineinfo.qc"
-#include "xonotic/dialog_hudpanel_healtharmor.qc"
-#include "xonotic/dialog_hudpanel_infomessages.qc"
-#include "xonotic/dialog_hudpanel_itemstime.qc"
-#include "xonotic/dialog_hudpanel_modicons.qc"
-#include "xonotic/dialog_hudpanel_notification.qc"
-#include "xonotic/dialog_hudpanel_physics.qc"
-#include "xonotic/dialog_hudpanel_powerups.qc"
-#include "xonotic/dialog_hudpanel_pressedkeys.qc"
-#include "xonotic/dialog_hudpanel_quickmenu.qc"
-#include "xonotic/dialog_hudpanel_racetimer.qc"
-#include "xonotic/dialog_hudpanel_radar.qc"
-#include "xonotic/dialog_hudpanel_score.qc"
-#include "xonotic/dialog_hudpanel_timer.qc"
-#include "xonotic/dialog_hudpanel_vote.qc"
-#include "xonotic/dialog_hudpanel_weapons.qc"
-#include "xonotic/dialog_hudsetup_exit.qc"
-#include "xonotic/dialog_monstertools.qc"
-#include "xonotic/dialog_multiplayer.qc"
-#include "xonotic/dialog_multiplayer_create.qc"
-#include "xonotic/dialog_multiplayer_create_mapinfo.qc"
-#include "xonotic/dialog_multiplayer_create_mutators.qc"
-#include "xonotic/dialog_multiplayer_join.qc"
-#include "xonotic/dialog_multiplayer_join_serverinfo.qc"
-#include "xonotic/dialog_multiplayer_media.qc"
-#include "xonotic/dialog_multiplayer_media_demo.qc"
-#include "xonotic/dialog_multiplayer_media_demo_startconfirm.qc"
-#include "xonotic/dialog_multiplayer_media_demo_timeconfirm.qc"
-#include "xonotic/dialog_multiplayer_media_musicplayer.qc"
-#include "xonotic/dialog_multiplayer_media_screenshot.qc"
-#include "xonotic/dialog_multiplayer_media_screenshot_viewer.qc"
-#include "xonotic/dialog_multiplayer_profile.qc"
-#include "xonotic/dialog_quit.qc"
-#include "xonotic/dialog_sandboxtools.qc"
-#include "xonotic/dialog_settings.qc"
-#include "xonotic/dialog_settings_audio.qc"
-#include "xonotic/dialog_settings_effects.qc"
-#include "xonotic/dialog_settings_game.qc"
-#include "xonotic/dialog_settings_game_crosshair.qc"
-#include "xonotic/dialog_settings_game_hudconfirm.qc"
-#include "xonotic/dialog_settings_game_hud.qc"
-#include "xonotic/dialog_settings_game_messages.qc"
-#include "xonotic/dialog_settings_game_model.qc"
-#include "xonotic/dialog_settings_game_view.qc"
-#include "xonotic/dialog_settings_game_weapons.qc"
-#include "xonotic/dialog_settings_input.qc"
-#include "xonotic/dialog_settings_input_userbind.qc"
-#include "xonotic/dialog_settings_misc.qc"
-#include "xonotic/dialog_settings_misc_cvars.qc"
-#include "xonotic/dialog_settings_misc_reset.qc"
-#include "xonotic/dialog_settings_user.qc"
-#include "xonotic/dialog_settings_user_languagewarning.qc"
-#include "xonotic/dialog_settings_video.qc"
-#include "xonotic/dialog_singleplayer.qc"
-#include "xonotic/dialog_singleplayer_winner.qc"
-#include "xonotic/dialog_teamselect.qc"
-#include "xonotic/gametypelist.qc"
-#include "xonotic/hudskinlist.qc"
-#include "xonotic/image.qc"
-#include "xonotic/inputbox.qc"
-#include "xonotic/keybinder.qc"
-#include "xonotic/languagelist.qc"
-#include "xonotic/listbox.qc"
-#include "xonotic/mainwindow.qc"
-#include "xonotic/maplist.qc"
-#include "xonotic/nexposee.qc"
-#include "xonotic/picker.qc"
-#include "xonotic/playerlist.qc"
-#include "xonotic/playermodel.qc"
-#include "xonotic/playlist.qc"
-#include "xonotic/radiobutton.qc"
-#include "xonotic/rootdialog.qc"
-#include "xonotic/screenshotimage.qc"
-#include "xonotic/screenshotlist.qc"
-#include "xonotic/serverlist.qc"
-#include "xonotic/skinlist.qc"
-#include "xonotic/slider.qc"
-#include "xonotic/slider_decibels.qc"
-#include "xonotic/slider_particles.qc"
-#include "xonotic/slider_picmip.qc"
-#include "xonotic/slider_resolution.qc"
-#include "xonotic/slider_sbfadetime.qc"
-#include "xonotic/soundlist.qc"
-#include "xonotic/statslist.qc"
-#include "xonotic/tabcontroller.qc"
-#include "xonotic/tab.qc"
-#include "xonotic/textlabel.qc"
-#include "xonotic/textslider.qc"
-#include "xonotic/weaponarenacheckbox.qc"
-#include "xonotic/weaponslist.qc"
+++ /dev/null
-#ifndef CLASSES_H
-#define CLASSES_H
-
-#include "classes.inc"
-#define IMPLEMENTATION
-#include "classes.inc"
-#undef IMPLEMENTATION
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "menu_cmd.qc"
-#include "../menu.qh"
-
#include <common/command/all.qc>
-
-#include "menu_cmd.qc"
+++ /dev/null
-#ifndef MENU_COMMANDS_ALL_H
-#define MENU_COMMANDS_ALL_H
-
-#include <common/command/commands.qh>
-
-#include "menu_cmd.qh"
-
-#endif
#include "menu_cmd.qh"
#include "../menu.qh"
-#include "../classes.qc"
+#include "../item.qh"
#include "../mutators/events.qh"
{
LOG_INFO(_("Available options:\n"));
- FOREACH_ENTITY_ORDERED(it.name != "", LAMBDA(
+ FOREACH_ENTITY_ORDERED(it.name != "", {
if (it.classname == "vtbl") continue;
string s = it.name;
if (filter)
s = substring(s, strlen(filter), strlen(s) - strlen(filter));
}
LOG_INFOF(" %s\n", s);
- ));
+ });
}
else if (argc == 2 && !isdemo()) // don't allow this command in demos
{
-#ifndef MENU_CMD_H
-#define MENU_CMD_H
+#pragma once
void GameCommand(string command);
-#endif
-#ifndef DRAW_H
-#define DRAW_H
+#pragma once
// from the engine
vector drawfontscale;
float draw_TextWidth_WithColors(string s, vector size);
float draw_TextWidth_WithoutColors(string s, vector size);
-#endif
#ifdef MENUQC
-#include "xonotic/tab.qc"
+#include "xonotic/tab.qh"
REGISTRY(Settings, BITS(3))
#define Settings_from(i) _Settings_from(i, NULL)
-#ifndef ITEM_H
-#define ITEM_H
-#include "skin.qh"
-CLASS(Item, Object)
- METHOD(Item, draw, void(Item));
- METHOD(Item, keyDown, float(Item, float, float, float));
- METHOD(Item, keyUp, float(Item, float, float, float));
- METHOD(Item, mouseMove, float(Item, vector));
- METHOD(Item, mousePress, float(Item, vector));
- METHOD(Item, mouseDrag, float(Item, vector));
- METHOD(Item, mouseRelease, float(Item, vector));
- METHOD(Item, focusEnter, void(Item));
- METHOD(Item, focusLeave, void(Item));
- METHOD(Item, resizeNotify, void(Item, vector, vector, vector, vector));
- METHOD(Item, relinquishFocus, void(Item));
- METHOD(Item, showNotify, void(Item));
- METHOD(Item, hideNotify, void(Item));
- METHOD(Item, toString, string(Item));
- METHOD(Item, destroy, void(Item));
- ATTRIB(Item, focused, float, 0)
- ATTRIB(Item, focusable, float, 0)
- ATTRIB(Item, allowFocusSound, float, 0)
- ATTRIB(Item, parent, entity, NULL)
- ATTRIB(Item, preferredFocusPriority, float, 0)
- ATTRIB(Item, origin, vector, '0 0 0')
- ATTRIB(Item, size, vector, '0 0 0')
- ATTRIB(Item, tooltip, string, string_null)
-ENDCLASS(Item)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "item.qh"
+
+#include "item/container.qh"
+#include "item/borderimage.qh"
+
METHOD(Item, destroy, void(Item this))
{
// free memory associated with this
return 0; // unhandled
}
+ void m_play_focus_sound();
+
METHOD(Item, focusEnter, void(Item this))
{
if (this.allowFocusSound) m_play_focus_sound();
{
return string_null;
}
-#endif
--- /dev/null
+#pragma once
+
+// convenience
+#include "skin.qh"
+
+CLASS(Item, Object)
+ METHOD(Item, draw, void(Item));
+ METHOD(Item, keyDown, float(Item, float, float, float));
+ METHOD(Item, keyUp, float(Item, float, float, float));
+ METHOD(Item, mouseMove, float(Item, vector));
+ METHOD(Item, mousePress, float(Item, vector));
+ METHOD(Item, mouseDrag, float(Item, vector));
+ METHOD(Item, mouseRelease, float(Item, vector));
+ METHOD(Item, focusEnter, void(Item));
+ METHOD(Item, focusLeave, void(Item));
+ METHOD(Item, resizeNotify, void(Item, vector, vector, vector, vector));
+ METHOD(Item, relinquishFocus, void(Item));
+ METHOD(Item, showNotify, void(Item));
+ METHOD(Item, hideNotify, void(Item));
+ METHOD(Item, toString, string(Item));
+ METHOD(Item, destroy, void(Item));
+ ATTRIB(Item, focused, float, 0)
+ ATTRIB(Item, focusable, float, 0)
+ ATTRIB(Item, allowFocusSound, float, 0)
+ ATTRIB(Item, parent, entity, NULL)
+ ATTRIB(Item, preferredFocusPriority, float, 0)
+ ATTRIB(Item, origin, vector, '0 0 0')
+ ATTRIB(Item, size, vector, '0 0 0')
+ ATTRIB(Item, tooltip, string, string_null)
+ENDCLASS(Item)
--- /dev/null
+// generated file; do not modify
+#include "borderimage.qc"
+#include "button.qc"
+#include "checkbox.qc"
+#include "container.qc"
+#include "dialog.qc"
+#include "image.qc"
+#include "inputbox.qc"
+#include "inputcontainer.qc"
+#include "label.qc"
+#include "listbox.qc"
+#include "modalcontroller.qc"
+#include "nexposee.qc"
+#include "radiobutton.qc"
+#include "slider.qc"
+#include "tab.qc"
+#include "textslider.qc"
-#ifndef ITEM_BORDERIMAGE_H
- #define ITEM_BORDERIMAGE_H
- #include "label.qc"
- CLASS(BorderImage, Label)
- METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float));
- METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(BorderImage, recalcPositionWithText, void(entity, string));
- ATTRIB(BorderImage, isBold, float, 1)
- METHOD(BorderImage, draw, void(entity));
- ATTRIB(BorderImage, src, string, string_null)
- ATTRIB(BorderImage, borderHeight, float, 0)
- ATTRIB(BorderImage, borderVec, vector, '0 0 0')
- ATTRIB(BorderImage, color, vector, '1 1 1')
- ATTRIB(BorderImage, closeButton, entity, NULL)
- ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
- ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
- ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
- ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
- ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
- ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
- ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
- ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
- ENDCLASS(BorderImage)
-#endif
+#include "borderimage.qh"
-#ifdef IMPLEMENTATION
+#include "nexposee.qh"
+#include "dialog.qh"
void BorderImage_recalcPositionWithText(entity me, string t)
{
if (me.isNexposeeTitleBar)
SUPER(BorderImage).draw(me);
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "label.qh"
+CLASS(BorderImage, Label)
+ METHOD(BorderImage, configureBorderImage, void(entity, string, float, vector, string, float));
+ METHOD(BorderImage, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(BorderImage, recalcPositionWithText, void(entity, string));
+ ATTRIB(BorderImage, isBold, float, 1)
+ METHOD(BorderImage, draw, void(entity));
+ ATTRIB(BorderImage, src, string, string_null)
+ ATTRIB(BorderImage, borderHeight, float, 0)
+ ATTRIB(BorderImage, borderVec, vector, '0 0 0')
+ ATTRIB(BorderImage, color, vector, '1 1 1')
+ ATTRIB(BorderImage, closeButton, entity, NULL)
+ ATTRIB(BorderImage, realFontSize_Nexposeed, vector, '0 0 0')
+ ATTRIB(BorderImage, realOrigin_Nexposeed, vector, '0 0 0')
+ ATTRIB(BorderImage, isNexposeeTitleBar, float, 0)
+ ATTRIB(BorderImage, zoomedOutTitleBarPosition, float, 0)
+ ATTRIB(BorderImage, zoomedOutTitleBar, float, 0)
+ ATTRIB(BorderImage, overrideRealOrigin, vector, '0 1 0')
+ ATTRIB(BorderImage, saveRelOrigin, vector, '0 0 0')
+ ATTRIB(BorderImage, saveRelSize, vector, '0 0 0')
+ENDCLASS(BorderImage)
+
+.vector colorC, colorF;
-#ifndef ITEM_BUTTON_H
- #define ITEM_BUTTON_H
- #include "label.qc"
- CLASS(Button, Label)
- METHOD(Button, configureButton, void(entity, string, float, string));
- METHOD(Button, draw, void(entity));
- METHOD(Button, showNotify, void(entity));
- METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(Button, keyDown, float(entity, float, float, float));
- METHOD(Button, mousePress, float(entity, vector));
- METHOD(Button, mouseDrag, float(entity, vector));
- METHOD(Button, mouseRelease, float(entity, vector));
- METHOD(Button, playClickSound, void(entity));
- ATTRIB(Button, onClick, void(entity, entity), func_null)
- ATTRIB(Button, onClickEntity, entity, NULL)
- ATTRIB(Button, src, string, string_null)
- ATTRIB(Button, srcSuffix, string, string_null)
- ATTRIB(Button, src2, string, string_null) // is centered, same aspect, and stretched to label size
- ATTRIB(Button, src2scale, float, 1)
- ATTRIB(Button, srcMulti, float, 1) // 0: button square left, text right; 1: button stretched, text over it
- ATTRIB(Button, buttonLeftOfText, float, 0)
- ATTRIB(Button, focusable, float, 1)
- ATTRIB(Button, allowFocusSound, float, 1)
- ATTRIB(Button, pressed, float, 0)
- ATTRIB(Button, clickTime, float, 0)
- ATTRIB(Button, applyButton, entity, NULL)
- ATTRIB(Button, disableOnClick, bool, false)
- ATTRIB(Button, disabled, float, 0)
- ATTRIB(Button, disabledAlpha, float, 0.3)
- ATTRIB(Button, forcePressed, float, 0)
- ATTRIB(Button, color, vector, '1 1 1')
- ATTRIB(Button, colorC, vector, '1 1 1')
- ATTRIB(Button, colorF, vector, '1 1 1')
- ATTRIB(Button, colorD, vector, '1 1 1')
- ATTRIB(Button, color2, vector, '1 1 1')
- ATTRIB(Button, alpha2, float, 1)
+#include "button.qh"
- ATTRIB(Button, origin, vector, '0 0 0')
- ATTRIB(Button, size, vector, '0 0 0')
- ENDCLASS(Button)
-#endif
-
-#ifdef IMPLEMENTATION
void Button_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
if (me.srcMulti) me.keepspaceLeft = 0;
else if (me.onClick == Dialog_Close) m_play_click_sound(MENU_SOUND_CLOSE);
else m_play_click_sound(MENU_SOUND_EXECUTE);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "modalcontroller.qh"
+
+#include "label.qh"
+CLASS(Button, Label)
+ METHOD(Button, configureButton, void(entity, string, float, string));
+ METHOD(Button, draw, void(entity));
+ METHOD(Button, showNotify, void(entity));
+ METHOD(Button, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(Button, keyDown, float(entity, float, float, float));
+ METHOD(Button, mousePress, float(entity, vector));
+ METHOD(Button, mouseDrag, float(entity, vector));
+ METHOD(Button, mouseRelease, float(entity, vector));
+ METHOD(Button, playClickSound, void(entity));
+ ATTRIB(Button, onClick, void(entity, entity), func_null)
+ ATTRIB(Button, onClickEntity, entity, NULL)
+ ATTRIB(Button, src, string, string_null)
+ ATTRIB(Button, srcSuffix, string, string_null)
+ ATTRIB(Button, src2, string, string_null) // is centered, same aspect, and stretched to label size
+ ATTRIB(Button, src2scale, float, 1)
+ ATTRIB(Button, srcMulti, float, 1) // 0: button square left, text right; 1: button stretched, text over it
+ ATTRIB(Button, buttonLeftOfText, float, 0)
+ ATTRIB(Button, focusable, float, 1)
+ ATTRIB(Button, allowFocusSound, float, 1)
+ ATTRIB(Button, pressed, float, 0)
+ ATTRIB(Button, clickTime, float, 0)
+ ATTRIB(Button, applyButton, entity, NULL)
+ ATTRIB(Button, disableOnClick, bool, false)
+ ATTRIB(Button, disabled, float, 0)
+ ATTRIB(Button, disabledAlpha, float, 0.3)
+ ATTRIB(Button, forcePressed, float, 0)
+ ATTRIB(Button, color, vector, '1 1 1')
+ ATTRIB(Button, colorC, vector, '1 1 1')
+ ATTRIB(Button, colorF, vector, '1 1 1')
+ ATTRIB(Button, colorD, vector, '1 1 1')
+ ATTRIB(Button, color2, vector, '1 1 1')
+ ATTRIB(Button, alpha2, float, 1)
+
+ ATTRIB(Button, origin, vector, '0 0 0')
+ ATTRIB(Button, size, vector, '0 0 0')
+ENDCLASS(Button)
-#ifndef ITEM_CHECKBOX_H
- #define ITEM_CHECKBOX_H
- #include "button.qc"
- void CheckBox_Click(entity me, entity other);
- CLASS(CheckBox, Button)
- METHOD(CheckBox, configureCheckBox, void(entity, string, float, string));
- METHOD(CheckBox, draw, void(entity));
- METHOD(CheckBox, playClickSound, void(entity));
- METHOD(CheckBox, toString, string(entity));
- METHOD(CheckBox, setChecked, void(entity, float));
- ATTRIB(CheckBox, useDownAsChecked, float, 0)
- ATTRIB(CheckBox, checked, float, 0)
- ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click)
- ATTRIB(CheckBox, srcMulti, float, 0)
- ATTRIB(CheckBox, disabled, float, 0)
- ENDCLASS(CheckBox)
-#endif
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
void CheckBox_setChecked(entity me, float val)
{
me.checked = val;
{
m_play_click_sound(MENU_SOUND_SELECT);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "button.qh"
+CLASS(CheckBox, Button)
+ METHOD(CheckBox, configureCheckBox, void(entity, string, float, string));
+ METHOD(CheckBox, draw, void(entity));
+ METHOD(CheckBox, playClickSound, void(entity));
+ METHOD(CheckBox, toString, string(entity));
+ METHOD(CheckBox, setChecked, void(entity, float));
+ ATTRIB(CheckBox, useDownAsChecked, float, 0)
+ ATTRIB(CheckBox, checked, float, 0)
+ void CheckBox_Click(entity me, entity other);
+ ATTRIB(CheckBox, onClick, void(entity, entity), CheckBox_Click)
+ ATTRIB(CheckBox, srcMulti, float, 0)
+ ATTRIB(CheckBox, disabled, float, 0)
+ENDCLASS(CheckBox)
-#ifndef ITEM_CONTAINER_H
- #define ITEM_CONTAINER_H
- #include "../item.qc"
- CLASS(Container, Item)
- METHOD(Container, draw, void(entity));
- METHOD(Container, keyUp, float(entity, float, float, float));
- METHOD(Container, keyDown, float(entity, float, float, float));
- METHOD(Container, mouseMove, float(entity, vector));
- METHOD(Container, mousePress, float(entity, vector));
- METHOD(Container, mouseDrag, float(entity, vector));
- METHOD(Container, mouseRelease, float(entity, vector));
- METHOD(Container, focusLeave, void(entity));
- METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector));
- METHOD(Container, addItem, void(entity, entity, vector, vector, float));
- METHOD(Container, addItemCentered, void(entity, entity, vector, float));
- METHOD(Container, addItemRightCentered, void(entity, entity, vector, float));
- METHOD(Container, moveItemAfter, void(entity, entity, entity));
- METHOD(Container, removeItem, void(entity, entity));
- METHOD(Container, setFocus, void(entity, entity));
- METHOD(Container, saveFocus, void(entity));
- METHOD(Container, setAlphaOf, void(entity, entity, float));
- METHOD(Container, itemFromPoint, entity(entity, vector));
- METHOD(Container, showNotify, void(entity));
- METHOD(Container, hideNotify, void(entity));
- METHOD(Container, preferredFocusedGrandChild, entity(entity));
- ATTRIB(Container, focusable, float, 0)
- ATTRIB(Container, firstChild, entity, NULL)
- ATTRIB(Container, lastChild, entity, NULL)
- ATTRIB(Container, focusedChild, entity, NULL)
- ATTRIB(Container, savedFocus, entity, NULL)
- ATTRIB(Container, shown, float, 0)
-
- METHOD(Container, enterSubitem, void(entity, entity));
- METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float));
- METHOD(Container, leaveSubitem, void(entity));
- ENDCLASS(Container)
- .entity nextSibling;
- .entity prevSibling;
- .float resized;
- .vector Container_origin;
- .vector Container_size;
- .vector Container_fontscale;
- .float Container_alpha;
- .vector Container_save_shift;
- .vector Container_save_scale;
- .vector Container_save_fontscale;
- .float Container_save_alpha;
-#endif
-
-#ifdef IMPLEMENTATION
+#include "container.qh"
+
void Container_enterSubitem(entity me, entity sub)
{
me.enterLieSubitem(me, sub.Container_origin, sub.Container_size, sub.Container_fontscale, sub.Container_alpha);
return best;
}
-#endif
--- /dev/null
+#pragma once
+
+#include <menu/item.qh>
+
+CLASS(Container, Item)
+ METHOD(Container, draw, void(entity));
+ METHOD(Container, keyUp, float(entity, float, float, float));
+ METHOD(Container, keyDown, float(entity, float, float, float));
+ METHOD(Container, mouseMove, float(entity, vector));
+ METHOD(Container, mousePress, float(entity, vector));
+ METHOD(Container, mouseDrag, float(entity, vector));
+ METHOD(Container, mouseRelease, float(entity, vector));
+ METHOD(Container, focusLeave, void(entity));
+ METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector));
+ METHOD(Container, addItem, void(entity, entity, vector, vector, float));
+ METHOD(Container, addItemCentered, void(entity, entity, vector, float));
+ METHOD(Container, addItemRightCentered, void(entity, entity, vector, float));
+ METHOD(Container, moveItemAfter, void(entity, entity, entity));
+ METHOD(Container, removeItem, void(entity, entity));
+ METHOD(Container, setFocus, void(entity, entity));
+ METHOD(Container, saveFocus, void(entity));
+ METHOD(Container, setAlphaOf, void(entity, entity, float));
+ METHOD(Container, itemFromPoint, entity(entity, vector));
+ METHOD(Container, showNotify, void(entity));
+ METHOD(Container, hideNotify, void(entity));
+ METHOD(Container, preferredFocusedGrandChild, entity(entity));
+ ATTRIB(Container, focusable, float, 0)
+ ATTRIB(Container, firstChild, entity, NULL)
+ ATTRIB(Container, lastChild, entity, NULL)
+ ATTRIB(Container, focusedChild, entity, NULL)
+ ATTRIB(Container, savedFocus, entity, NULL)
+ ATTRIB(Container, shown, float, 0)
+
+ METHOD(Container, enterSubitem, void(entity, entity));
+ METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float));
+ METHOD(Container, leaveSubitem, void(entity));
+ENDCLASS(Container)
+
+.entity nextSibling;
+.entity prevSibling;
+.float resized;
+.vector Container_origin;
+.vector Container_size;
+.vector Container_fontscale;
+.float Container_alpha;
+.vector Container_save_shift;
+.vector Container_save_scale;
+.vector Container_save_fontscale;
+.float Container_save_alpha;
-// Note: this class is called Dialog, but it can also handle a tab under the following conditions:
-// - isTabRoot is 0
-// - backgroundImage is the tab's background
-// - closable is 0
-// - rootDialog is 0
-// - title is ""
-// - marginTop is
-// - intendedHeight ends up to be the tab's actual height, or at least close
-// - titleFontSize is 0
-// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
-// To ensure the latter, you best create all tabs FIRST and insert the tabbed
-// control to your dialog THEN - with the right height
-//
-// a subclass may help with using this as a tab
-
-#ifndef ITEM_DIALOG_H
- #define ITEM_DIALOG_H
- #include "inputcontainer.qc"
- CLASS(Dialog, InputContainer)
- METHOD(Dialog, configureDialog, void(entity)); // no runtime configuration, all parameters are given in the code!
- METHOD(Dialog, fill, void(entity)); // to be overridden by user to fill the dialog with controls
- METHOD(Dialog, keyDown, float(entity, float, float, float));
- METHOD(Dialog, close, void(entity));
- METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector));
-
- METHOD(Dialog, TD, void(entity, float, float, entity));
- METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector));
- METHOD(Dialog, TDempty, void(entity, float));
- METHOD(Dialog, setFirstColumn, void(entity, float));
- METHOD(Dialog, TR, void(entity));
- METHOD(Dialog, gotoRC, void(entity, float, float));
-
- ATTRIB(Dialog, isTabRoot, float, 1)
- ATTRIB(Dialog, closeButton, entity, NULL)
- ATTRIB(Dialog, intendedHeight, float, 0)
- ATTRIB(Dialog, itemOrigin, vector, '0 0 0')
- ATTRIB(Dialog, itemSize, vector, '0 0 0')
- ATTRIB(Dialog, itemSpacing, vector, '0 0 0')
- ATTRIB(Dialog, currentRow, float, 0)
- ATTRIB(Dialog, currentColumn, float, 0)
- ATTRIB(Dialog, firstColumn, float, 0)
-
- // to be customized
- ATTRIB(Dialog, closable, float, 1)
- ATTRIB(Dialog, title, string, "Form1") // ;)
- ATTRIB(Dialog, color, vector, '1 0.5 1')
- ATTRIB(Dialog, intendedWidth, float, 0)
- ATTRIB(Dialog, rows, float, 3)
- ATTRIB(Dialog, columns, float, 2)
-
- ATTRIB(Dialog, marginTop, float, 0) // pixels
- ATTRIB(Dialog, marginBottom, float, 0) // pixels
- ATTRIB(Dialog, marginLeft, float, 0) // pixels
- ATTRIB(Dialog, marginRight, float, 0) // pixels
- ATTRIB(Dialog, columnSpacing, float, 0) // pixels
- ATTRIB(Dialog, rowSpacing, float, 0) // pixels
- ATTRIB(Dialog, rowHeight, float, 0) // pixels
- ATTRIB(Dialog, titleHeight, float, 0) // pixels
- ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
- ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
- ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
-
- ATTRIB(Dialog, requiresConnection, float, 0) // set to true if the dialog requires a connection to be opened
-
- ATTRIB(Dialog, backgroundImage, string, string_null)
- ATTRIB(Dialog, borderLines, float, 1)
- ATTRIB(Dialog, closeButtonImage, string, string_null)
-
- ATTRIB(Dialog, frame, entity, NULL)
- ENDCLASS(Dialog)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "dialog.qh"
+
+#include "borderimage.qh"
+#include "button.qh"
+#include "nexposee.qh"
+
void Dialog_Close(entity button, entity me)
{
me.close(me);
}
return SUPER(Dialog).keyDown(me, key, ascii, shift);
}
-#endif
--- /dev/null
+#pragma once
+
+// Note: this class is called Dialog, but it can also handle a tab under the following conditions:
+// - isTabRoot is 0
+// - backgroundImage is the tab's background
+// - closable is 0
+// - rootDialog is 0
+// - title is ""
+// - marginTop is
+// - intendedHeight ends up to be the tab's actual height, or at least close
+// - titleFontSize is 0
+// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
+// To ensure the latter, you best create all tabs FIRST and insert the tabbed
+// control to your dialog THEN - with the right height
+//
+// a subclass may help with using this as a tab
+
+#include "inputcontainer.qh"
+CLASS(Dialog, InputContainer)
+ METHOD(Dialog, configureDialog, void(entity)); // no runtime configuration, all parameters are given in the code!
+ METHOD(Dialog, fill, void(entity)); // to be overridden by user to fill the dialog with controls
+ METHOD(Dialog, keyDown, float(entity, float, float, float));
+ METHOD(Dialog, close, void(entity));
+ METHOD(Dialog, addItemSimple, void(entity, float, float, float, float, entity, vector));
+
+ METHOD(Dialog, TD, void(entity, float, float, entity));
+ METHOD(Dialog, TDNoMargin, void(entity, float, float, entity, vector));
+ METHOD(Dialog, TDempty, void(entity, float));
+ METHOD(Dialog, setFirstColumn, void(entity, float));
+ METHOD(Dialog, TR, void(entity));
+ METHOD(Dialog, gotoRC, void(entity, float, float));
+
+ ATTRIB(Dialog, isTabRoot, float, 1)
+ ATTRIB(Dialog, closeButton, entity, NULL)
+ ATTRIB(Dialog, intendedHeight, float, 0)
+ ATTRIB(Dialog, itemOrigin, vector, '0 0 0')
+ ATTRIB(Dialog, itemSize, vector, '0 0 0')
+ ATTRIB(Dialog, itemSpacing, vector, '0 0 0')
+ ATTRIB(Dialog, currentRow, float, 0)
+ ATTRIB(Dialog, currentColumn, float, 0)
+ ATTRIB(Dialog, firstColumn, float, 0)
+
+ // to be customized
+ ATTRIB(Dialog, closable, float, 1)
+ ATTRIB(Dialog, title, string, "Form1") // ;)
+ ATTRIB(Dialog, color, vector, '1 0.5 1')
+ ATTRIB(Dialog, intendedWidth, float, 0)
+ ATTRIB(Dialog, rows, float, 3)
+ ATTRIB(Dialog, columns, float, 2)
+
+ ATTRIB(Dialog, marginTop, float, 0) // pixels
+ ATTRIB(Dialog, marginBottom, float, 0) // pixels
+ ATTRIB(Dialog, marginLeft, float, 0) // pixels
+ ATTRIB(Dialog, marginRight, float, 0) // pixels
+ ATTRIB(Dialog, columnSpacing, float, 0) // pixels
+ ATTRIB(Dialog, rowSpacing, float, 0) // pixels
+ ATTRIB(Dialog, rowHeight, float, 0) // pixels
+ ATTRIB(Dialog, titleHeight, float, 0) // pixels
+ ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
+ ATTRIB(Dialog, zoomedOutTitleBarPosition, float, 0)
+ ATTRIB(Dialog, zoomedOutTitleBar, float, 0)
+
+ ATTRIB(Dialog, requiresConnection, float, 0) // set to true if the dialog requires a connection to be opened
+
+ ATTRIB(Dialog, backgroundImage, string, string_null)
+ ATTRIB(Dialog, borderLines, float, 1)
+ ATTRIB(Dialog, closeButtonImage, string, string_null)
+
+ ATTRIB(Dialog, frame, entity, NULL)
+ENDCLASS(Dialog)
+
+void Dialog_Close(entity button, entity me);
-#ifndef ITEM_IMAGE_H
- #define ITEM_IMAGE_H
- #include "../item.qc"
- CLASS(Image, Item)
- METHOD(Image, configureImage, void(entity, string));
- METHOD(Image, draw, void(entity));
- METHOD(Image, toString, string(entity));
- METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(Image, updateAspect, void(entity));
- METHOD(Image, initZoom, void(entity));
- METHOD(Image, setZoom, void(entity, float, float));
- METHOD(Image, drag_setStartPos, float(entity, vector));
- METHOD(Image, drag, float(entity, vector));
- ATTRIB(Image, src, string, string_null)
- ATTRIB(Image, color, vector, '1 1 1')
- ATTRIB(Image, forcedAspect, float, 0) // special values: -1 keep image aspect ratio, -2 keep image size but bound to the containing box, -3 always keep image size
- ATTRIB(Image, zoomBox, float, 0) // used by forcedAspect -2 when the image is larger than the containing box
- ATTRIB(Image, zoomFactor, float, 1)
- ATTRIB(Image, zoomOffset, vector, '0.5 0.5 0')
- ATTRIB(Image, zoomSnapToTheBox, float, 1) // snap the zoomed in image to the box borders when zooming/dragging it
- ATTRIB(Image, zoomTime, float, 0)
- ATTRIB(Image, zoomLimitedByTheBox, float, 0) // forbids zoom if image would be larger than the containing box
- ATTRIB(Image, zoomMax, float, 0)
- ATTRIB(Image, start_zoomOffset, vector, '0 0 0')
- ATTRIB(Image, start_coords, vector, '0 0 0')
- ATTRIB(Image, imgOrigin, vector, '0 0 0')
- ATTRIB(Image, imgSize, vector, '0 0 0')
- ENDCLASS(Image)
-#endif
+#include "image.qh"
-#ifdef IMPLEMENTATION
string Image_toString(entity me)
{
return me.src;
SUPER(Image).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
me.updateAspect(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item.qh"
+CLASS(Image, Item)
+ METHOD(Image, configureImage, void(entity, string));
+ METHOD(Image, draw, void(entity));
+ METHOD(Image, toString, string(entity));
+ METHOD(Image, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(Image, updateAspect, void(entity));
+ METHOD(Image, initZoom, void(entity));
+ METHOD(Image, setZoom, void(entity, float, float));
+ METHOD(Image, drag_setStartPos, float(entity, vector));
+ METHOD(Image, drag, float(entity, vector));
+ ATTRIB(Image, src, string, string_null)
+ ATTRIB(Image, color, vector, '1 1 1')
+ ATTRIB(Image, forcedAspect, float, 0) // special values: -1 keep image aspect ratio, -2 keep image size but bound to the containing box, -3 always keep image size
+ ATTRIB(Image, zoomBox, float, 0) // used by forcedAspect -2 when the image is larger than the containing box
+ ATTRIB(Image, zoomFactor, float, 1)
+ ATTRIB(Image, zoomOffset, vector, '0.5 0.5 0')
+ ATTRIB(Image, zoomSnapToTheBox, float, 1) // snap the zoomed in image to the box borders when zooming/dragging it
+ ATTRIB(Image, zoomTime, float, 0)
+ ATTRIB(Image, zoomLimitedByTheBox, float, 0) // forbids zoom if image would be larger than the containing box
+ ATTRIB(Image, zoomMax, float, 0)
+ ATTRIB(Image, start_zoomOffset, vector, '0 0 0')
+ ATTRIB(Image, start_coords, vector, '0 0 0')
+ ATTRIB(Image, imgOrigin, vector, '0 0 0')
+ ATTRIB(Image, imgSize, vector, '0 0 0')
+ENDCLASS(Image)
-#ifndef ITEM_INPUTBOX_H
- #define ITEM_INPUTBOX_H
- #include "label.qc"
- CLASS(InputBox, Label)
- METHOD(InputBox, configureInputBox, void(entity, string, float, float, string));
- METHOD(InputBox, draw, void(entity));
- METHOD(InputBox, setText, void(entity, string));
- METHOD(InputBox, enterText, void(entity, string));
- METHOD(InputBox, keyDown, float(entity, float, float, float));
- METHOD(InputBox, mouseMove, float(entity, vector));
- METHOD(InputBox, mouseRelease, float(entity, vector));
- METHOD(InputBox, mousePress, float(entity, vector));
- METHOD(InputBox, mouseDrag, float(entity, vector));
- METHOD(InputBox, showNotify, void(entity));
- METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector));
+#include "inputbox.qh"
- ATTRIB(InputBox, src, string, string_null)
+.float cb_offset;
+.string cb_src;
- ATTRIB(InputBox, cursorPos, float, 0) // characters
- ATTRIB(InputBox, scrollPos, float, 0) // widths
-
- ATTRIB(InputBox, focusable, float, 1)
- ATTRIB(InputBox, allowFocusSound, float, 1)
- ATTRIB(InputBox, disabled, float, 0)
- ATTRIB(InputBox, lastChangeTime, float, 0)
- ATTRIB(InputBox, dragScrollTimer, float, 0)
- ATTRIB(InputBox, dragScrollPos, vector, '0 0 0')
- ATTRIB(InputBox, pressed, float, 0)
- ATTRIB(InputBox, editColorCodes, float, 1)
- ATTRIB(InputBox, forbiddenCharacters, string, "")
- ATTRIB(InputBox, color, vector, '1 1 1')
- ATTRIB(InputBox, colorF, vector, '1 1 1')
- ATTRIB(InputBox, maxLength, float, 255) // if negative, it counts bytes, not chars
- ATTRIB(InputBox, applyButton, entity, NULL)
-
- ATTRIB(InputBox, enableClearButton, float, 1)
- ATTRIB(InputBox, clearButton, entity, NULL)
- ATTRIB(InputBox, cb_width, float, 0)
- ATTRIB(InputBox, cb_pressed, float, 0)
- ATTRIB(InputBox, cb_focused, float, 0)
- ATTRIB(InputBox, cb_color, vector, '1 1 1')
- ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
- ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
- ENDCLASS(InputBox)
-#endif
-
-#ifdef IMPLEMENTATION
void InputBox_configureInputBox(entity me, string theText, float theCursorPos, float theFontSize, string gfx)
{
SUPER(InputBox).configureLabel(me, theText, theFontSize, 0.0);
{
me.focusable = !me.disabled;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "label.qh"
+CLASS(InputBox, Label)
+ METHOD(InputBox, configureInputBox, void(entity, string, float, float, string));
+ METHOD(InputBox, draw, void(entity));
+ METHOD(InputBox, setText, void(entity, string));
+ METHOD(InputBox, enterText, void(entity, string));
+ METHOD(InputBox, keyDown, float(entity, float, float, float));
+ METHOD(InputBox, mouseMove, float(entity, vector));
+ METHOD(InputBox, mouseRelease, float(entity, vector));
+ METHOD(InputBox, mousePress, float(entity, vector));
+ METHOD(InputBox, mouseDrag, float(entity, vector));
+ METHOD(InputBox, showNotify, void(entity));
+ METHOD(InputBox, resizeNotify, void(entity, vector, vector, vector, vector));
+
+ ATTRIB(InputBox, src, string, string_null)
+
+ ATTRIB(InputBox, cursorPos, float, 0) // characters
+ ATTRIB(InputBox, scrollPos, float, 0) // widths
+
+ ATTRIB(InputBox, focusable, float, 1)
+ ATTRIB(InputBox, allowFocusSound, float, 1)
+ ATTRIB(InputBox, disabled, float, 0)
+ ATTRIB(InputBox, lastChangeTime, float, 0)
+ ATTRIB(InputBox, dragScrollTimer, float, 0)
+ ATTRIB(InputBox, dragScrollPos, vector, '0 0 0')
+ ATTRIB(InputBox, pressed, float, 0)
+ ATTRIB(InputBox, editColorCodes, float, 1)
+ ATTRIB(InputBox, forbiddenCharacters, string, "")
+ ATTRIB(InputBox, color, vector, '1 1 1')
+ ATTRIB(InputBox, colorF, vector, '1 1 1')
+ ATTRIB(InputBox, maxLength, float, 255) // if negative, it counts bytes, not chars
+ ATTRIB(InputBox, applyButton, entity, NULL)
+
+ ATTRIB(InputBox, enableClearButton, float, 1)
+ ATTRIB(InputBox, clearButton, entity, NULL)
+ ATTRIB(InputBox, cb_width, float, 0)
+ ATTRIB(InputBox, cb_pressed, float, 0)
+ ATTRIB(InputBox, cb_focused, float, 0)
+ ATTRIB(InputBox, cb_color, vector, '1 1 1')
+ ATTRIB(InputBox, cb_colorF, vector, '1 1 1')
+ ATTRIB(InputBox, cb_colorC, vector, '1 1 1')
+ENDCLASS(InputBox)
-#ifndef ITEM_INPUTCONTAINER_H
- #define ITEM_INPUTCONTAINER_H
- #include "container.qc"
- CLASS(InputContainer, Container)
- METHOD(InputContainer, keyDown, float(entity, float, float, float));
- METHOD(InputContainer, mouseMove, float(entity, vector));
- METHOD(InputContainer, mousePress, float(entity, vector));
- METHOD(InputContainer, mouseRelease, float(entity, vector));
- METHOD(InputContainer, mouseDrag, float(entity, vector));
- METHOD(InputContainer, focusLeave, void(entity));
- METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector));
+#include "inputcontainer.qh"
- METHOD(InputContainer, _changeFocusXY, bool(entity this, vector pos));
- ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
- ATTRIB(InputContainer, isTabRoot, float, 0)
- ENDCLASS(InputContainer)
-#endif
-
-#ifdef IMPLEMENTATION
void InputContainer_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
SUPER(InputContainer).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
return 0;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "container.qh"
+CLASS(InputContainer, Container)
+ METHOD(InputContainer, keyDown, float(entity, float, float, float));
+ METHOD(InputContainer, mouseMove, float(entity, vector));
+ METHOD(InputContainer, mousePress, float(entity, vector));
+ METHOD(InputContainer, mouseRelease, float(entity, vector));
+ METHOD(InputContainer, mouseDrag, float(entity, vector));
+ METHOD(InputContainer, focusLeave, void(entity));
+ METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector));
+
+ METHOD(InputContainer, _changeFocusXY, bool(entity this, vector pos));
+ ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
+ ATTRIB(InputContainer, isTabRoot, float, 0)
+ENDCLASS(InputContainer)
-#ifndef ITEM_LABEL_H
- #define ITEM_LABEL_H
- #include "../item.qc"
- CLASS(Label, Item)
- METHOD(Label, configureLabel, void(entity, string, float, float));
- METHOD(Label, draw, void(entity));
- METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(Label, setText, void(entity, string));
- METHOD(Label, toString, string(entity));
- METHOD(Label, recalcPositionWithText, void(entity, string));
- ATTRIB(Label, isBold, float, 0)
- ATTRIB(Label, text, string, string_null)
- ATTRIB(Label, currentText, string, string_null)
- ATTRIB(Label, fontSize, float, 8)
- ATTRIB(Label, align, float, 0.5)
- ATTRIB(Label, allowCut, float, 0)
- ATTRIB(Label, allowColors, float, 0)
- ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
- ATTRIB(Label, keepspaceRight, float, 0)
- ATTRIB(Label, marginLeft, float, 0) // alternate way to specify keepspace* (in characters from the font)
- ATTRIB(Label, marginRight, float, 0)
- ATTRIB(Label, realFontSize, vector, '0 0 0')
- ATTRIB(Label, realOrigin, vector, '0 0 0')
- ATTRIB(Label, alpha, float, 0.7)
- ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
- ATTRIB(Label, disabled, float, 0)
- ATTRIB(Label, disabledAlpha, float, 0.3)
- ATTRIB(Label, textEntity, entity, NULL)
- ATTRIB(Label, allowWrap, float, 0)
- ATTRIB(Label, recalcPos, float, 0)
- ATTRIB(Label, condenseFactor, float, 1)
- ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
- ATTRIB(Label, overrideCondenseFactor, float, 0)
- ENDCLASS(Label)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "label.qh"
+
string Label_toString(entity me)
{
return me.text;
SUPER(Label).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item.qh"
+CLASS(Label, Item)
+ METHOD(Label, configureLabel, void(entity, string, float, float));
+ METHOD(Label, draw, void(entity));
+ METHOD(Label, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(Label, setText, void(entity, string));
+ METHOD(Label, toString, string(entity));
+ METHOD(Label, recalcPositionWithText, void(entity, string));
+ ATTRIB(Label, isBold, float, 0)
+ ATTRIB(Label, text, string, string_null)
+ ATTRIB(Label, currentText, string, string_null)
+ ATTRIB(Label, fontSize, float, 8)
+ ATTRIB(Label, align, float, 0.5)
+ ATTRIB(Label, allowCut, float, 0)
+ ATTRIB(Label, allowColors, float, 0)
+ ATTRIB(Label, keepspaceLeft, float, 0) // for use by subclasses (radiobuttons for example)
+ ATTRIB(Label, keepspaceRight, float, 0)
+ ATTRIB(Label, marginLeft, float, 0) // alternate way to specify keepspace* (in characters from the font)
+ ATTRIB(Label, marginRight, float, 0)
+ ATTRIB(Label, realFontSize, vector, '0 0 0')
+ ATTRIB(Label, realOrigin, vector, '0 0 0')
+ ATTRIB(Label, alpha, float, 0.7)
+ ATTRIB(Label, colorL, vector, SKINCOLOR_TEXT)
+ ATTRIB(Label, disabled, float, 0)
+ ATTRIB(Label, disabledAlpha, float, 0.3)
+ ATTRIB(Label, textEntity, entity, NULL)
+ ATTRIB(Label, allowWrap, float, 0)
+ ATTRIB(Label, recalcPos, float, 0)
+ ATTRIB(Label, condenseFactor, float, 1)
+ ATTRIB(Label, overrideRealOrigin, vector, '0 0 0')
+ ATTRIB(Label, overrideCondenseFactor, float, 0)
+ENDCLASS(Label)
-#ifndef ITEM_LISTBOX_H
- #define ITEM_LISTBOX_H
- #include "../item.qc"
- CLASS(ListBox, Item)
- METHOD(ListBox, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(ListBox, configureListBox, void(entity, float, float));
- METHOD(ListBox, draw, void(entity));
- METHOD(ListBox, keyDown, float(entity, float, float, float));
- METHOD(ListBox, mouseMove, float(entity, vector));
- METHOD(ListBox, mousePress, float(entity, vector));
- METHOD(ListBox, mouseDrag, float(entity, vector));
- METHOD(ListBox, mouseRelease, float(entity, vector));
- METHOD(ListBox, focusLeave, void(entity));
- ATTRIB(ListBox, focusable, float, 1)
- ATTRIB(ListBox, focusedItem, int, -1)
- ATTRIB(ListBox, focusedItemAlpha, float, 0.3)
- METHOD(ListBox, setFocusedItem, void(entity, int));
- ATTRIB(ListBox, mouseMoveOffset, float, -1) // let know where the cursor is when the list scrolls without moving the cursor
- ATTRIB(ListBox, allowFocusSound, float, 1)
- ATTRIB(ListBox, selectedItem, int, 0)
- ATTRIB(ListBox, size, vector, '0 0 0')
- ATTRIB(ListBox, origin, vector, '0 0 0')
- ATTRIB(ListBox, scrollPos, float, 0) // measured in window heights, fixed when needed
- ATTRIB(ListBox, scrollPosTarget, float, 0)
- METHOD(ListBox, isScrolling, bool(entity));
- ATTRIB(ListBox, needScrollToItem, float, -1)
- METHOD(ListBox, scrollToItem, void(entity, int));
- ATTRIB(ListBox, previousValue, float, 0)
- ATTRIB(ListBox, pressed, float, 0) // 0 = normal, 1 = scrollbar dragging, 2 = item dragging, 3 = released
- ATTRIB(ListBox, pressOffset, float, 0)
+#include "listbox.qh"
- METHOD(ListBox, updateControlTopBottom, void(entity));
- ATTRIB(ListBox, controlTop, float, 0)
- ATTRIB(ListBox, controlBottom, float, 0)
- ATTRIB(ListBox, controlWidth, float, 0)
- ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
- ATTRIB(ListBox, selectionDoesntMatter, bool, false) // improves scrolling by keys for lists that don't need to show an active selection
-
- ATTRIB(ListBox, src, string, string_null) // scrollbar
- ATTRIB(ListBox, color, vector, '1 1 1')
- ATTRIB(ListBox, color2, vector, '1 1 1')
- ATTRIB(ListBox, colorC, vector, '1 1 1')
- ATTRIB(ListBox, colorF, vector, '1 1 1')
- ATTRIB(ListBox, tolerance, vector, '0 0 0') // drag tolerance
- ATTRIB(ListBox, scrollbarWidth, float, 0) // pixels
- ATTRIB(ListBox, nItems, float, 42) // FIXME: why?!?
- ATTRIB(ListBox, itemHeight, float, 0)
- ATTRIB(ListBox, colorBG, vector, '0 0 0')
- ATTRIB(ListBox, alphaBG, float, 0)
-
- ATTRIB(ListBox, lastClickedItem, float, -1)
- ATTRIB(ListBox, lastClickedTime, float, 0)
-
- METHOD(ListBox, drawListBoxItem, void(entity, int, vector, bool, bool)); // item number, width/height, isSelected, isFocused
- METHOD(ListBox, clickListBoxItem, void(entity, float, vector)); // item number, relative clickpos
- METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector)); // item number, relative clickpos
- METHOD(ListBox, setSelected, void(entity, float));
- METHOD(ListBox, focusedItemChangeNotify, void(entity));
-
- METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float));
- METHOD(ListBox, getFirstFullyVisibleItemAtScrollPos, float(entity, float));
-
- // NOTE: override these four methods if you want variable sized list items
- METHOD(ListBox, getTotalHeight, float(entity));
- METHOD(ListBox, getItemAtPos, float(entity, float));
- METHOD(ListBox, getItemStart, float(entity, float));
- METHOD(ListBox, getItemHeight, float(entity, float));
- // NOTE: if getItemAt* are overridden, it may make sense to cache the
- // start and height of the last item returned by getItemAtPos and fast
- // track returning their properties for getItemStart and getItemHeight.
- // The "hot" code path calls getItemAtPos first, then will query
- // getItemStart and getItemHeight on it soon.
- // When overriding, the following consistency rules must hold:
- // getTotalHeight() == SUM(getItemHeight(i), i, 0, me.nItems-1)
- // getItemStart(i+1) == getItemStart(i) + getItemHeight(i)
- // for 0 <= i < me.nItems-1
- // getItemStart(0) == 0
- // getItemStart(getItemAtPos(p)) <= p
- // if p >= 0
- // getItemAtPos(p) == 0
- // if p < 0
- // getItemStart(getItemAtPos(p)) + getItemHeight(getItemAtPos(p)) > p
- // if p < getTotalHeigt()
- // getItemAtPos(p) == me.nItems - 1
- // if p >= getTotalHeight()
- ENDCLASS(ListBox)
-#endif
-
-#ifdef IMPLEMENTATION
bool ListBox_isScrolling(entity me)
{
return me.scrollPos != me.scrollPosTarget;
{
draw_Text('0 0 0', sprintf(_("Item %d"), i), eX * (8 / absSize.x) + eY * (8 / absSize.y), (isSelected ? '0 1 0' : '1 1 1'), 1, 0);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item.qh"
+CLASS(ListBox, Item)
+ METHOD(ListBox, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(ListBox, configureListBox, void(entity, float, float));
+ METHOD(ListBox, draw, void(entity));
+ METHOD(ListBox, keyDown, float(entity, float, float, float));
+ METHOD(ListBox, mouseMove, float(entity, vector));
+ METHOD(ListBox, mousePress, float(entity, vector));
+ METHOD(ListBox, mouseDrag, float(entity, vector));
+ METHOD(ListBox, mouseRelease, float(entity, vector));
+ METHOD(ListBox, focusLeave, void(entity));
+ ATTRIB(ListBox, focusable, float, 1)
+ ATTRIB(ListBox, focusedItem, int, -1)
+ ATTRIB(ListBox, focusedItemAlpha, float, 0.3)
+ METHOD(ListBox, setFocusedItem, void(entity, int));
+ ATTRIB(ListBox, mouseMoveOffset, float, -1) // let know where the cursor is when the list scrolls without moving the cursor
+ ATTRIB(ListBox, allowFocusSound, float, 1)
+ ATTRIB(ListBox, selectedItem, int, 0)
+ ATTRIB(ListBox, size, vector, '0 0 0')
+ ATTRIB(ListBox, origin, vector, '0 0 0')
+ ATTRIB(ListBox, scrollPos, float, 0) // measured in window heights, fixed when needed
+ ATTRIB(ListBox, scrollPosTarget, float, 0)
+ METHOD(ListBox, isScrolling, bool(entity));
+ ATTRIB(ListBox, needScrollToItem, float, -1)
+ METHOD(ListBox, scrollToItem, void(entity, int));
+ ATTRIB(ListBox, previousValue, float, 0)
+ ATTRIB(ListBox, pressed, float, 0) // 0 = normal, 1 = scrollbar dragging, 2 = item dragging, 3 = released
+ ATTRIB(ListBox, pressOffset, float, 0)
+
+ METHOD(ListBox, updateControlTopBottom, void(entity));
+ ATTRIB(ListBox, controlTop, float, 0)
+ ATTRIB(ListBox, controlBottom, float, 0)
+ ATTRIB(ListBox, controlWidth, float, 0)
+ ATTRIB(ListBox, dragScrollPos, vector, '0 0 0')
+ ATTRIB(ListBox, selectionDoesntMatter, bool, false) // improves scrolling by keys for lists that don't need to show an active selection
+
+ ATTRIB(ListBox, src, string, string_null) // scrollbar
+ ATTRIB(ListBox, color, vector, '1 1 1')
+ ATTRIB(ListBox, color2, vector, '1 1 1')
+ ATTRIB(ListBox, colorC, vector, '1 1 1')
+ ATTRIB(ListBox, colorF, vector, '1 1 1')
+ ATTRIB(ListBox, tolerance, vector, '0 0 0') // drag tolerance
+ ATTRIB(ListBox, scrollbarWidth, float, 0) // pixels
+ ATTRIB(ListBox, nItems, float, 42) // FIXME: why?!?
+ ATTRIB(ListBox, itemHeight, float, 0)
+ ATTRIB(ListBox, itemAbsSize, vector, '0 0 0')
+ ATTRIB(ListBox, colorBG, vector, '0 0 0')
+ ATTRIB(ListBox, alphaBG, float, 0)
+
+ ATTRIB(ListBox, lastClickedItem, float, -1)
+ ATTRIB(ListBox, lastClickedTime, float, 0)
+
+ METHOD(ListBox, drawListBoxItem, void(entity, int, vector, bool, bool)); // item number, width/height, isSelected, isFocused
+ METHOD(ListBox, clickListBoxItem, void(entity, float, vector)); // item number, relative clickpos
+ METHOD(ListBox, doubleClickListBoxItem, void(entity, float, vector)); // item number, relative clickpos
+ METHOD(ListBox, setSelected, void(entity, float));
+ METHOD(ListBox, focusedItemChangeNotify, void(entity));
+
+ METHOD(ListBox, getLastFullyVisibleItemAtScrollPos, float(entity, float));
+ METHOD(ListBox, getFirstFullyVisibleItemAtScrollPos, float(entity, float));
+
+ // NOTE: override these four methods if you want variable sized list items
+ METHOD(ListBox, getTotalHeight, float(entity));
+ METHOD(ListBox, getItemAtPos, float(entity, float));
+ METHOD(ListBox, getItemStart, float(entity, float));
+ METHOD(ListBox, getItemHeight, float(entity, float));
+ // NOTE: if getItemAt* are overridden, it may make sense to cache the
+ // start and height of the last item returned by getItemAtPos and fast
+ // track returning their properties for getItemStart and getItemHeight.
+ // The "hot" code path calls getItemAtPos first, then will query
+ // getItemStart and getItemHeight on it soon.
+ // When overriding, the following consistency rules must hold:
+ // getTotalHeight() == SUM(getItemHeight(i), i, 0, me.nItems-1)
+ // getItemStart(i+1) == getItemStart(i) + getItemHeight(i)
+ // for 0 <= i < me.nItems-1
+ // getItemStart(0) == 0
+ // getItemStart(getItemAtPos(p)) <= p
+ // if p >= 0
+ // getItemAtPos(p) == 0
+ // if p < 0
+ // getItemStart(getItemAtPos(p)) + getItemHeight(getItemAtPos(p)) > p
+ // if p < getTotalHeigt()
+ // getItemAtPos(p) == me.nItems - 1
+ // if p >= getTotalHeight()
+ENDCLASS(ListBox)
-#ifndef ITEM_MODALCONTROLLER_H
- #define ITEM_MODALCONTROLLER_H
- #include "container.qc"
- CLASS(ModalController, Container)
- METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(ModalController, draw, void(entity));
- METHOD(ModalController, showChild, void(entity, entity, vector, vector, float));
- METHOD(ModalController, hideChild, void(entity, entity, float));
- METHOD(ModalController, hideAll, void(entity, float));
- METHOD(ModalController, addItem, void(entity, entity, vector, vector, float));
- METHOD(ModalController, addTab, void(entity, entity, entity));
+#include "modalcontroller.qh"
- METHOD(ModalController, initializeDialog, void(entity, entity));
-
- METHOD(ModalController, switchState, void(entity, entity, float, float));
- ATTRIB(ModalController, origin, vector, '0 0 0')
- ATTRIB(ModalController, size, vector, '0 0 0')
- ATTRIB(ModalController, previousButton, entity, NULL)
- ATTRIB(ModalController, fadedAlpha, float, 0.3)
- ENDCLASS(ModalController)
-
- .entity tabSelectingButton;
- .vector origin;
- .vector size;
- void TabButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
- void DialogOpenButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
- void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
- void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
-#endif
-
-#ifdef IMPLEMENTATION
-
-// modal dialog controller
-// handles a stack of dialog elements
-// each element can have one of the following states:
-// 0: hidden (fading out)
-// 1: visible (zooming in)
-// 2: greyed out (inactive)
-// While an animation is running, no item has focus. When an animation is done,
-// the topmost item gets focus.
-// The items are assumed to be added in overlapping order, that is, the lowest
-// window must get added first.
-//
-// Possible uses:
-// - to control a modal dialog:
-// - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
-// - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
-// - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
-// - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
-// - as a tabbed dialog control:
-// - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
-// - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
+#include "button.qh"
.vector ModalController_initialSize;
.vector ModalController_initialOrigin;
}
} // just alpha fade out (factor increases and decreases alpha)
}
-#endif
--- /dev/null
+#pragma once
+
+// modal dialog controller
+// handles a stack of dialog elements
+// each element can have one of the following states:
+// 0: hidden (fading out)
+// 1: visible (zooming in)
+// 2: greyed out (inactive)
+// While an animation is running, no item has focus. When an animation is done,
+// the topmost item gets focus.
+// The items are assumed to be added in overlapping order, that is, the lowest
+// window must get added first.
+//
+// Possible uses:
+// - to control a modal dialog:
+// - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
+// - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
+// - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
+// - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
+// - as a tabbed dialog control:
+// - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
+// - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
+
+#include "container.qh"
+CLASS(ModalController, Container)
+ METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(ModalController, draw, void(entity));
+ METHOD(ModalController, showChild, void(entity, entity, vector, vector, float));
+ METHOD(ModalController, hideChild, void(entity, entity, float));
+ METHOD(ModalController, hideAll, void(entity, float));
+ METHOD(ModalController, addItem, void(entity, entity, vector, vector, float));
+ METHOD(ModalController, addTab, void(entity, entity, entity));
+
+ METHOD(ModalController, initializeDialog, void(entity, entity));
+
+ METHOD(ModalController, switchState, void(entity, entity, float, float));
+ ATTRIB(ModalController, origin, vector, '0 0 0')
+ ATTRIB(ModalController, size, vector, '0 0 0')
+ ATTRIB(ModalController, previousButton, entity, NULL)
+ ATTRIB(ModalController, fadedAlpha, float, 0.3)
+ENDCLASS(ModalController)
+
+.float ModalController_state;
+.entity tabSelectingButton;
+.vector origin;
+.vector size;
+void TabButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
+void DialogOpenButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
+void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
+void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
-#ifndef ITEM_NEXPOSEE_H
- #define ITEM_NEXPOSEE_H
- #include "container.qc"
- CLASS(Nexposee, Container)
- METHOD(Nexposee, draw, void(entity));
- METHOD(Nexposee, keyDown, float(entity, float, float, float));
- METHOD(Nexposee, keyUp, float(entity, float, float, float));
- METHOD(Nexposee, mousePress, float(entity, vector));
- METHOD(Nexposee, mouseMove, float(entity, vector));
- METHOD(Nexposee, mouseRelease, float(entity, vector));
- METHOD(Nexposee, mouseDrag, float(entity, vector));
- METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(Nexposee, focusEnter, void(entity));
- METHOD(Nexposee, close, void(entity));
+#include "nexposee.qh"
- ATTRIB(Nexposee, animationState, float, -1)
- ATTRIB(Nexposee, animationFactor, float, 0)
- ATTRIB(Nexposee, selectedChild, entity, NULL)
- ATTRIB(Nexposee, mouseFocusedChild, entity, NULL)
- METHOD(Nexposee, addItem, void(entity, entity, vector, vector, float));
- METHOD(Nexposee, calc, void(entity));
- METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float));
- ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
- METHOD(Nexposee, pullNexposee, void(entity, entity, vector));
- ENDCLASS(Nexposee)
-
- void ExposeeCloseButton_Click(entity button, entity other); // un-exposees the current state
-
-// animation states:
-// 0 = thumbnails seen
-// 1 = zooming in
-// 2 = zoomed in
-// 3 = zooming out
-// animation factor: 0 = minimum theSize, 1 = maximum theSize
- .vector Nexposee_initialSize;
- .vector Nexposee_initialFontScale;
- .vector Nexposee_initialOrigin;
- .float Nexposee_initialAlpha;
-
- .vector Nexposee_smallSize;
- .vector Nexposee_smallOrigin;
- .float Nexposee_smallAlpha;
- .float Nexposee_mediumAlpha;
- .vector Nexposee_scaleCenter;
- .vector Nexposee_align;
- .float Nexposee_animationFactor;
-
-#endif
-
-#ifdef IMPLEMENTATION
void Nexposee_close(entity me)
{
// user must override this
}
break;
- : have_overlap
+LABEL(have_overlap)
}
scale *= 0.95;
{
other.Nexposee_align = theAlign;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "container.qh"
+CLASS(Nexposee, Container)
+ METHOD(Nexposee, draw, void(entity));
+ METHOD(Nexposee, keyDown, float(entity, float, float, float));
+ METHOD(Nexposee, keyUp, float(entity, float, float, float));
+ METHOD(Nexposee, mousePress, float(entity, vector));
+ METHOD(Nexposee, mouseMove, float(entity, vector));
+ METHOD(Nexposee, mouseRelease, float(entity, vector));
+ METHOD(Nexposee, mouseDrag, float(entity, vector));
+ METHOD(Nexposee, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(Nexposee, focusEnter, void(entity));
+ METHOD(Nexposee, close, void(entity));
+
+ ATTRIB(Nexposee, animationState, float, -1)
+ ATTRIB(Nexposee, animationFactor, float, 0)
+ ATTRIB(Nexposee, selectedChild, entity, NULL)
+ ATTRIB(Nexposee, mouseFocusedChild, entity, NULL)
+ METHOD(Nexposee, addItem, void(entity, entity, vector, vector, float));
+ METHOD(Nexposee, calc, void(entity));
+ METHOD(Nexposee, setNexposee, void(entity, entity, vector, float, float));
+ ATTRIB(Nexposee, mousePosition, vector, '0 0 0')
+ METHOD(Nexposee, pullNexposee, void(entity, entity, vector));
+ENDCLASS(Nexposee)
+
+void ExposeeCloseButton_Click(entity button, entity other); // un-exposees the current state
+
+// animation states:
+// 0 = thumbnails seen
+// 1 = zooming in
+// 2 = zoomed in
+// 3 = zooming out
+// animation factor: 0 = minimum theSize, 1 = maximum theSize
+.vector Nexposee_initialSize;
+.vector Nexposee_initialFontScale;
+.vector Nexposee_initialOrigin;
+.float Nexposee_initialAlpha;
+
+.vector Nexposee_smallSize;
+.vector Nexposee_smallOrigin;
+.float Nexposee_smallAlpha;
+.float Nexposee_mediumAlpha;
+.vector Nexposee_scaleCenter;
+.vector Nexposee_align;
+.float Nexposee_animationFactor;
-#ifndef ITEM_RADIOBUTTON_H
- #define ITEM_RADIOBUTTON_H
- #include "checkbox.qc"
- void RadioButton_Click(entity me, entity other);
- CLASS(RadioButton, CheckBox)
- METHOD(RadioButton, configureRadioButton, void(entity, string, float, string, float, float));
- ATTRIB(RadioButton, checked, float, 0)
- ATTRIB(RadioButton, group, float, 0)
- ATTRIB(RadioButton, allowDeselect, float, 0)
- ATTRIB(RadioButton, onClick, void(entity, entity), RadioButton_Click)
- ENDCLASS(RadioButton)
-#endif
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void RadioButton_configureRadioButton(entity me, string txt, float sz, string gfx, float theGroup, float doAllowDeselect)
{
me.configureCheckBox(me, txt, sz, gfx);
me.setChecked(me, 1);
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "checkbox.qh"
+void RadioButton_Click(entity me, entity other);
+CLASS(RadioButton, CheckBox)
+ METHOD(RadioButton, configureRadioButton, void(entity, string, float, string, float, float));
+ ATTRIB(RadioButton, checked, float, 0)
+ ATTRIB(RadioButton, group, float, 0)
+ ATTRIB(RadioButton, allowDeselect, float, 0)
+ ATTRIB(RadioButton, onClick, void(entity, entity), RadioButton_Click)
+ENDCLASS(RadioButton)
-// Note:
-// to use this, you FIRST call configureSliderVisuals, then configureSliderValues
-#ifndef ITEM_SLIDER_H
- #define ITEM_SLIDER_H
- #include "label.qc"
- CLASS(Slider, Label)
- METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(Slider, configureSliderVisuals, void(entity, float, float, float, string));
- METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float));
- METHOD(Slider, draw, void(entity));
- METHOD(Slider, keyDown, float(entity, float, float, float));
- METHOD(Slider, keyUp, float(entity, float, float, float));
- METHOD(Slider, mousePress, float(entity, vector));
- METHOD(Slider, mouseDrag, float(entity, vector));
- METHOD(Slider, mouseRelease, float(entity, vector));
- METHOD(Slider, valueToText, string(entity, float));
- METHOD(Slider, toString, string(entity));
- METHOD(Slider, setValue_allowAnim, void(entity, float, bool));
- METHOD(Slider, setValue_noAnim, void(entity, float));
- METHOD(Slider, setValue, void(entity, float));
- METHOD(Slider, setSliderValue, void(entity, float));
- METHOD(Slider, showNotify, void(entity));
- ATTRIB(Slider, src, string, string_null)
- ATTRIB(Slider, focusable, float, 1)
- ATTRIB(Slider, allowFocusSound, float, 1)
- ATTRIB(Slider, value, float, 0)
- ATTRIB(Slider, animated, float, 1)
- ATTRIB(Slider, sliderValue, float, 0)
- ATTRIB(Slider, sliderAnim, entity, NULL)
- ATTRIB(Slider, valueMin, float, 0)
- ATTRIB(Slider, valueMax, float, 0)
- ATTRIB(Slider, valueStep, float, 0)
- ATTRIB(Slider, valueDigits, float, 0)
- ATTRIB(Slider, valueKeyStep, float, 0)
- ATTRIB(Slider, valuePageStep, float, 0)
- ATTRIB(Slider, valueDisplayMultiplier, float, 1.0)
- ATTRIB(Slider, textSpace, float, 0)
- ATTRIB(Slider, controlWidth, float, 0)
- ATTRIB(Slider, pressed, float, 0)
- ATTRIB(Slider, pressOffset, float, 0)
- ATTRIB(Slider, previousValue, float, 0)
- ATTRIB(Slider, tolerance, vector, '0 0 0')
- ATTRIB(Slider, disabled, float, 0)
- ATTRIB(Slider, color, vector, '1 1 1')
- ATTRIB(Slider, color2, vector, '1 1 1')
- ATTRIB(Slider, colorD, vector, '1 1 1')
- ATTRIB(Slider, colorC, vector, '1 1 1')
- ATTRIB(Slider, colorF, vector, '1 1 1')
- ATTRIB(Slider, disabledAlpha, float, 0.3)
- ENDCLASS(Slider)
-#endif
+#include "slider.qh"
+
+#include "../anim/easing.qh"
+#include "../anim/animhost.qh"
+
+.entity applyButton;
-#ifdef IMPLEMENTATION
void Slider_setValue_allowAnim(entity me, float val, bool allowAnim)
{
if (allowAnim && me.animated)
SUPER(Slider).draw(me);
me.text = string_null; // TEMPSTRING!
}
-#endif
--- /dev/null
+#pragma once
+
+// Note:
+// to use this, you FIRST call configureSliderVisuals, then configureSliderValues
+#include "label.qh"
+CLASS(Slider, Label)
+ METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(Slider, configureSliderVisuals, void(entity, float, float, float, string));
+ METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float));
+ METHOD(Slider, draw, void(entity));
+ METHOD(Slider, keyDown, float(entity, float, float, float));
+ METHOD(Slider, keyUp, float(entity, float, float, float));
+ METHOD(Slider, mousePress, float(entity, vector));
+ METHOD(Slider, mouseDrag, float(entity, vector));
+ METHOD(Slider, mouseRelease, float(entity, vector));
+ METHOD(Slider, valueToText, string(entity, float));
+ METHOD(Slider, toString, string(entity));
+ METHOD(Slider, setValue_allowAnim, void(entity, float, bool));
+ METHOD(Slider, setValue_noAnim, void(entity, float));
+ METHOD(Slider, setValue, void(entity, float));
+ METHOD(Slider, setSliderValue, void(entity, float));
+ METHOD(Slider, showNotify, void(entity));
+ ATTRIB(Slider, src, string, string_null)
+ ATTRIB(Slider, focusable, float, 1)
+ ATTRIB(Slider, allowFocusSound, float, 1)
+ ATTRIB(Slider, value, float, 0)
+ ATTRIB(Slider, animated, float, 1)
+ ATTRIB(Slider, sliderValue, float, 0)
+ ATTRIB(Slider, sliderAnim, entity, NULL)
+ ATTRIB(Slider, valueMin, float, 0)
+ ATTRIB(Slider, valueMax, float, 0)
+ ATTRIB(Slider, valueStep, float, 0)
+ ATTRIB(Slider, valueDigits, float, 0)
+ ATTRIB(Slider, valueKeyStep, float, 0)
+ ATTRIB(Slider, valuePageStep, float, 0)
+ ATTRIB(Slider, valueDisplayMultiplier, float, 1.0)
+ ATTRIB(Slider, textSpace, float, 0)
+ ATTRIB(Slider, controlWidth, float, 0)
+ ATTRIB(Slider, pressed, float, 0)
+ ATTRIB(Slider, pressOffset, float, 0)
+ ATTRIB(Slider, previousValue, float, 0)
+ ATTRIB(Slider, tolerance, vector, '0 0 0')
+ ATTRIB(Slider, disabled, float, 0)
+ ATTRIB(Slider, color, vector, '1 1 1')
+ ATTRIB(Slider, color2, vector, '1 1 1')
+ ATTRIB(Slider, colorD, vector, '1 1 1')
+ ATTRIB(Slider, colorC, vector, '1 1 1')
+ ATTRIB(Slider, colorF, vector, '1 1 1')
+ ATTRIB(Slider, disabledAlpha, float, 0.3)
+ENDCLASS(Slider)
-#ifndef ITEM_TAB_H
- #define ITEM_TAB_H
- #include "dialog.qc"
- CLASS(Tab, Dialog)
- ATTRIB(Tab, isTabRoot, float, 0)
- ATTRIB(Tab, closable, float, 0)
- ATTRIB(Tab, rootDialog, float, 0)
- ATTRIB(Tab, title, string, string_null)
- ATTRIB(Tab, titleFontSize, float, 0) // pixels
-
- // still to be customized
- ATTRIB(Tab, intendedWidth, float, 0)
- ATTRIB(Tab, rows, float, 3)
- ATTRIB(Tab, columns, float, 2)
-
- ATTRIB(Tab, marginTop, float, 0) // pixels
- ATTRIB(Tab, marginBottom, float, 0) // pixels
- ATTRIB(Tab, marginLeft, float, 0) // pixels
- ATTRIB(Tab, marginRight, float, 0) // pixels
- ATTRIB(Tab, columnSpacing, float, 0) // pixels
- ATTRIB(Tab, rowSpacing, float, 0) // pixels
- ATTRIB(Tab, rowHeight, float, 0) // pixels
- ATTRIB(Tab, titleHeight, float, 0) // pixels
-
- ATTRIB(Tab, backgroundImage, string, string_null)
- ENDCLASS(Tab)
-#endif
-
-#ifdef IMPLEMENTATION
-#endif
+#include "tab.qh"
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(Tab, Dialog)
+ ATTRIB(Tab, isTabRoot, float, 0)
+ ATTRIB(Tab, closable, float, 0)
+ ATTRIB(Tab, rootDialog, float, 0)
+ ATTRIB(Tab, title, string, string_null)
+ ATTRIB(Tab, titleFontSize, float, 0) // pixels
+
+ // still to be customized
+ ATTRIB(Tab, intendedWidth, float, 0)
+ ATTRIB(Tab, rows, float, 3)
+ ATTRIB(Tab, columns, float, 2)
+
+ ATTRIB(Tab, marginTop, float, 0) // pixels
+ ATTRIB(Tab, marginBottom, float, 0) // pixels
+ ATTRIB(Tab, marginLeft, float, 0) // pixels
+ ATTRIB(Tab, marginRight, float, 0) // pixels
+ ATTRIB(Tab, columnSpacing, float, 0) // pixels
+ ATTRIB(Tab, rowSpacing, float, 0) // pixels
+ ATTRIB(Tab, rowHeight, float, 0) // pixels
+ ATTRIB(Tab, titleHeight, float, 0) // pixels
+
+ ATTRIB(Tab, backgroundImage, string, string_null)
+ENDCLASS(Tab)
-// Note:
-// to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
-#ifndef ITEM_TEXTSLIDER_H
- #define ITEM_TEXTSLIDER_H
- #include "slider.qc"
- CLASS(TextSlider, Slider)
- METHOD(TextSlider, valueToText, string(entity, float));
- METHOD(TextSlider, valueToIdentifier, string(entity, float));
- METHOD(TextSlider, setValueFromIdentifier_allowAnim, void(entity, string, bool));
- METHOD(TextSlider, setValueFromIdentifier_noAnim, void(entity, string));
- METHOD(TextSlider, setValueFromIdentifier, void(entity, string));
- METHOD(TextSlider, getIdentifier, string(entity));
- METHOD(TextSlider, clearValues, void(entity));
- METHOD(TextSlider, addValue, void(entity, string, string));
- METHOD(TextSlider, insertValue, void(entity, float, string, string));
- METHOD(TextSlider, configureTextSliderValues, void(entity, string));
- ATTRIBARRAY(TextSlider, valueStrings, string, 256)
- ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
- ATTRIB(TextSlider, nValues, int, 0)
- ENDCLASS(TextSlider)
-#endif
+#include "textslider.qh"
-#ifdef IMPLEMENTATION
string TextSlider_valueToIdentifier(entity me, int val)
{
if (val >= me.nValues) return "custom";
me.configureSliderValues(me, 0, 0, me.nValues - 1, 1, 1, 1);
me.setValueFromIdentifier_noAnim(me, theDefault);
}
-#endif
--- /dev/null
+#pragma once
+
+// Note:
+// to use this, you FIRST call configureSliderVisuals, then multiple times addValue, then configureTextSlider
+#include "slider.qh"
+CLASS(TextSlider, Slider)
+ METHOD(TextSlider, valueToText, string(entity, float));
+ METHOD(TextSlider, valueToIdentifier, string(entity, float));
+ METHOD(TextSlider, setValueFromIdentifier_allowAnim, void(entity, string, bool));
+ METHOD(TextSlider, setValueFromIdentifier_noAnim, void(entity, string));
+ METHOD(TextSlider, setValueFromIdentifier, void(entity, string));
+ METHOD(TextSlider, getIdentifier, string(entity));
+ METHOD(TextSlider, clearValues, void(entity));
+ METHOD(TextSlider, addValue, void(entity, string, string));
+ METHOD(TextSlider, insertValue, void(entity, float, string, string));
+ METHOD(TextSlider, configureTextSliderValues, void(entity, string));
+ ATTRIBARRAY(TextSlider, valueStrings, string, 256)
+ ATTRIBARRAY(TextSlider, valueIdentifiers, string, 256)
+ ATTRIB(TextSlider, nValues, int, 0)
+ENDCLASS(TextSlider)
#include "menu.qh"
-#include "classes.qc"
+
+#include "item.qh"
+
+#include "anim/animhost.qh"
+
+#include "item/dialog.qh"
+#include "item/listbox.qh"
+#include "item/nexposee.qh"
+
+#include "xonotic/commandbutton.qh"
+#include "xonotic/mainwindow.qh"
+#include "xonotic/serverlist.qh"
+#include "xonotic/slider_resolution.qh"
+
+.string cvarName;
+
#include "xonotic/util.qh"
#include "../common/items/all.qh"
-#include "../common/weapons/all.qh"
+#include <common/weapons/all.qh>
#include "../common/mapinfo.qh"
#include "../common/mutators/base.qh"
draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l + 1)), a);
}
++l;
- : nopic
+LABEL(nopic)
}
}
{
it = m_findtooltipitem(main, pos);
- if (it.instanceOfListBox && it.isScrolling(it)) it = world;
+ if (it.instanceOfListBox && it.isScrolling(it)) it = NULL;
if (it && prev_tooltip != it.tooltip)
{
void m_draw(float width, float height)
{
+ if (clientstate() == CS_DISCONNECTED) m_toggle(true);
m_gamestatus();
execute_next_frame();
void Shutdown()
{
m_hide();
- FOREACH_ENTITY_ORDERED(it.destroy, LAMBDA(
+ FOREACH_ENTITY_ORDERED(it.destroy, {
if (it.classname == "vtbl") continue;
it.destroy(it);
- ));
+ });
}
void m_focus_item_chain(entity outermost, entity innermost)
-#ifndef MENU_H
-#define MENU_H
+#pragma once
#include "draw.qh"
#include "skin.qh"
#include "xonotic/util.qh"
-#include "../common/constants.qh"
-#include "../common/util.qh"
+#include <common/constants.qh>
+#include <common/util.qh>
const int GAME_ISSERVER = BIT(0);
const int GAME_CONNECTED = BIT(1);
void m_play_focus_sound();
void m_play_click_sound(string soundfile);
-#endif
--- /dev/null
+// generated file; do not modify
-#ifndef MENU_MUTATORS_EVENTS_H
-#define MENU_MUTATORS_EVENTS_H
+#pragma once
#include <common/mutators/base.qh>
/** whole command, use only if you really have to */ i(string, cmd_string) \
/**/
MUTATOR_HOOKABLE(Menu_ConsoleCommand, EV_Menu_ConsoleCommand);
-#endif
-#include "../lib/_all.inc"
+#include <lib/_all.inc>
-#define world NULL
+#include "_mod.inc"
+#include "anim/_mod.inc"
+#include "command/_mod.inc"
+#include "item/_mod.inc"
+#include "mutators/_mod.inc"
+#include "xonotic/_mod.inc"
-#include "classes.qc"
-
-#include "draw.qc"
-#include "menu.qc"
-
-#include "command/all.qc"
-
-#include "xonotic/util.qc"
-
-#include "../common/_all.inc"
+#include <common/_all.inc>
#if BUILD_MOD
#include "../../mod/menu/progs.inc"
-#ifndef SKIN_H
-#define SKIN_H
+#pragma once
#define SKINBEGIN
#define SKINVECTOR(name,def) vector SKIN##name = def
#undef SKINFLOAT
#undef SKINVECTOR
#undef SKINBEGIN
-#endif
--- /dev/null
+// generated file; do not modify
+#include "bigbutton.qc"
+#include "bigcommandbutton.qc"
+#include "button.qc"
+#include "campaign.qc"
+#include "charmap.qc"
+#include "checkbox.qc"
+#include "checkbox_slider_invalid.qc"
+#include "checkbox_string.qc"
+#include "colorbutton.qc"
+#include "colorpicker.qc"
+#include "colorpicker_string.qc"
+#include "commandbutton.qc"
+#include "credits.qc"
+#include "crosshairpicker.qc"
+#include "crosshairpreview.qc"
+#include "cvarlist.qc"
+#include "datasource.qc"
+#include "demolist.qc"
+#include "dialog.qc"
+#include "dialog_credits.qc"
+#include "dialog_firstrun.qc"
+#include "dialog_hudpanel_ammo.qc"
+#include "dialog_hudpanel_centerprint.qc"
+#include "dialog_hudpanel_chat.qc"
+#include "dialog_hudpanel_engineinfo.qc"
+#include "dialog_hudpanel_healtharmor.qc"
+#include "dialog_hudpanel_infomessages.qc"
+#include "dialog_hudpanel_itemstime.qc"
+#include "dialog_hudpanel_modicons.qc"
+#include "dialog_hudpanel_notification.qc"
+#include "dialog_hudpanel_physics.qc"
+#include "dialog_hudpanel_powerups.qc"
+#include "dialog_hudpanel_pressedkeys.qc"
+#include "dialog_hudpanel_quickmenu.qc"
+#include "dialog_hudpanel_racetimer.qc"
+#include "dialog_hudpanel_radar.qc"
+#include "dialog_hudpanel_score.qc"
+#include "dialog_hudpanel_timer.qc"
+#include "dialog_hudpanel_vote.qc"
+#include "dialog_hudpanel_weapons.qc"
+#include "dialog_hudsetup_exit.qc"
+#include "dialog_monstertools.qc"
+#include "dialog_multiplayer.qc"
+#include "dialog_multiplayer_create.qc"
+#include "dialog_multiplayer_create_mapinfo.qc"
+#include "dialog_multiplayer_create_mutators.qc"
+#include "dialog_multiplayer_join.qc"
+#include "dialog_multiplayer_join_serverinfo.qc"
+#include "dialog_multiplayer_media.qc"
+#include "dialog_multiplayer_media_demo.qc"
+#include "dialog_multiplayer_media_demo_startconfirm.qc"
+#include "dialog_multiplayer_media_demo_timeconfirm.qc"
+#include "dialog_multiplayer_media_musicplayer.qc"
+#include "dialog_multiplayer_media_screenshot.qc"
+#include "dialog_multiplayer_media_screenshot_viewer.qc"
+#include "dialog_multiplayer_profile.qc"
+#include "dialog_quit.qc"
+#include "dialog_sandboxtools.qc"
+#include "dialog_settings.qc"
+#include "dialog_settings_audio.qc"
+#include "dialog_settings_effects.qc"
+#include "dialog_settings_game.qc"
+#include "dialog_settings_game_crosshair.qc"
+#include "dialog_settings_game_hud.qc"
+#include "dialog_settings_game_hudconfirm.qc"
+#include "dialog_settings_game_messages.qc"
+#include "dialog_settings_game_model.qc"
+#include "dialog_settings_game_view.qc"
+#include "dialog_settings_game_weapons.qc"
+#include "dialog_settings_input.qc"
+#include "dialog_settings_input_userbind.qc"
+#include "dialog_settings_misc.qc"
+#include "dialog_settings_misc_cvars.qc"
+#include "dialog_settings_misc_reset.qc"
+#include "dialog_settings_user.qc"
+#include "dialog_settings_user_languagewarning.qc"
+#include "dialog_settings_video.qc"
+#include "dialog_singleplayer.qc"
+#include "dialog_singleplayer_winner.qc"
+#include "dialog_teamselect.qc"
+#include "gametypelist.qc"
+#include "hudskinlist.qc"
+#include "image.qc"
+#include "inputbox.qc"
+#include "keybinder.qc"
+#include "languagelist.qc"
+#include "listbox.qc"
+#include "mainwindow.qc"
+#include "maplist.qc"
+#include "nexposee.qc"
+#include "picker.qc"
+#include "playerlist.qc"
+#include "playermodel.qc"
+#include "playlist.qc"
+#include "radiobutton.qc"
+#include "rootdialog.qc"
+#include "screenshotimage.qc"
+#include "screenshotlist.qc"
+#include "serverlist.qc"
+#include "skinlist.qc"
+#include "slider.qc"
+#include "slider_decibels.qc"
+#include "slider_particles.qc"
+#include "slider_picmip.qc"
+#include "slider_resolution.qc"
+#include "slider_sbfadetime.qc"
+#include "soundlist.qc"
+#include "statslist.qc"
+#include "tab.qc"
+#include "tabcontroller.qc"
+#include "textlabel.qc"
+#include "textslider.qc"
+#include "util.qc"
+#include "weaponarenacheckbox.qc"
+#include "weaponslist.qc"
-#ifndef BIGBUTTON_H
-#define BIGBUTTON_H
-#include "button.qc"
-CLASS(XonoticBigButton, XonoticButton)
- METHOD(XonoticBigButton, configureXonoticBigButton, void(entity, string, vector));
- ATTRIB(XonoticBigButton, image, string, SKINGFX_BUTTON_BIG)
- ATTRIB(XonoticBigButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
-ENDCLASS(XonoticBigButton)
-entity makeXonoticBigButton(string theText, vector theColor);
-#endif
+#include "bigbutton.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticBigButton(string theText, vector theColor)
{
entity me;
{
me.configureXonoticButton(me, theText, theColor, string_null);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "button.qh"
+CLASS(XonoticBigButton, XonoticButton)
+ METHOD(XonoticBigButton, configureXonoticBigButton, void(entity, string, vector));
+ ATTRIB(XonoticBigButton, image, string, SKINGFX_BUTTON_BIG)
+ ATTRIB(XonoticBigButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
+ENDCLASS(XonoticBigButton)
+entity makeXonoticBigButton(string theText, vector theColor);
-#ifndef BIGCOMMANDBUTTON_H
-#define BIGCOMMANDBUTTON_H
-#include "commandbutton.qc"
-CLASS(XonoticBigCommandButton, XonoticCommandButton)
- METHOD(XonoticBigCommandButton, configureXonoticBigCommandButton, void(entity, string, vector, string, float, string));
- ATTRIB(XonoticBigCommandButton, image, string, SKINGFX_BUTTON_BIG)
- ATTRIB(XonoticBigCommandButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
-ENDCLASS(XonoticBigCommandButton)
-entity makeXonoticBigCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
-entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#endif
+#include "bigcommandbutton.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticBigCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
{
entity me;
{
me.configureXonoticCommandButton(me, theText, theColor, theCommand, theFlags, theTooltip);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "commandbutton.qh"
+CLASS(XonoticBigCommandButton, XonoticCommandButton)
+ METHOD(XonoticBigCommandButton, configureXonoticBigCommandButton, void(entity, string, vector, string, float, string));
+ ATTRIB(XonoticBigCommandButton, image, string, SKINGFX_BUTTON_BIG)
+ ATTRIB(XonoticBigCommandButton, grayImage, string, SKINGFX_BUTTON_BIG_GRAY)
+ENDCLASS(XonoticBigCommandButton)
+entity makeXonoticBigCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
+entity makeXonoticBigCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#ifndef BUTTON_H
-#define BUTTON_H
-#include "../item/button.qc"
-CLASS(XonoticButton, Button)
- METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector, string));
- ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
- ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
- ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
- ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
- ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
- ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
- ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
- ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
- ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
-ENDCLASS(XonoticButton)
-entity makeXonoticButton_T(string theText, vector theColor, string theTooltip);
-entity makeXonoticButton(string theText, vector theColor);
-#endif
+#include "button.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticButton_T(string theText, vector theColor, string theTooltip)
{
entity me;
}
setZonedTooltip(me, theTooltip, string_null);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/button.qh"
+CLASS(XonoticButton, Button)
+ METHOD(XonoticButton, configureXonoticButton, void(entity, string, vector, string));
+ ATTRIB(XonoticButton, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticButton, image, string, SKINGFX_BUTTON)
+ ATTRIB(XonoticButton, grayImage, string, SKINGFX_BUTTON_GRAY)
+ ATTRIB(XonoticButton, color, vector, SKINCOLOR_BUTTON_N)
+ ATTRIB(XonoticButton, colorC, vector, SKINCOLOR_BUTTON_C)
+ ATTRIB(XonoticButton, colorF, vector, SKINCOLOR_BUTTON_F)
+ ATTRIB(XonoticButton, colorD, vector, SKINCOLOR_BUTTON_D)
+ ATTRIB(XonoticButton, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticButton, disabledAlpha, float, SKINALPHA_DISABLED)
+ ATTRIB(XonoticButton, marginLeft, float, SKINMARGIN_BUTTON) // chars
+ ATTRIB(XonoticButton, marginRight, float, SKINMARGIN_BUTTON) // chars
+ENDCLASS(XonoticButton)
+
+entity makeXonoticButton_T(string theText, vector theColor, string theTooltip);
+entity makeXonoticButton(string theText, vector theColor);
-#include <common/campaign_common.qh>
-
-#ifndef CAMPAIGN_H
-#define CAMPAIGN_H
-#include "listbox.qc"
-CLASS(XonoticCampaignList, XonoticListBox)
- METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity));
- ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
- METHOD(XonoticCampaignList, draw, void(entity));
- METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticCampaignList, setSelected, void(entity, float));
- METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float));
- METHOD(XonoticCampaignList, campaignGo, void(entity, float));
- METHOD(XonoticCampaignList, destroy, void(entity));
-
- ATTRIB(XonoticCampaignList, campaignGlob, float, 0)
- ATTRIB(XonoticCampaignList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticCampaignList, columnPreviewOrigin, float, 0)
- ATTRIB(XonoticCampaignList, columnPreviewSize, float, 0)
- ATTRIB(XonoticCampaignList, columnNameOrigin, float, 0)
- ATTRIB(XonoticCampaignList, columnNameSize, float, 0)
- ATTRIB(XonoticCampaignList, columnCheckMarkOrigin, float, 0)
- ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0)
- ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0')
- ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0')
- ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
- ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
+#include "campaign.qh"
- ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
- ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
-
- ATTRIB(XonoticCampaignList, campaignIndex, float, 0)
- ATTRIB(XonoticCampaignList, cvarName, string, string_null)
- METHOD(XonoticCampaignList, loadCvars, void(entity));
- METHOD(XonoticCampaignList, saveCvars, void(entity));
-
- ATTRIB(XonoticCampaignList, buttonNext, entity, NULL)
- ATTRIB(XonoticCampaignList, buttonPrev, entity, NULL)
- ATTRIB(XonoticCampaignList, labelTitle, entity, NULL)
-ENDCLASS(XonoticCampaignList)
-entity makeXonoticCampaignList();
-void CampaignList_LoadMap(entity btn, entity me);
-void MultiCampaign_Next(entity btn, entity me);
-void MultiCampaign_Prev(entity btn, entity me);
-#endif
+#include <common/campaign_common.qh>
+#include "inputbox.qh"
-#ifdef IMPLEMENTATION
string campaign_longdesc_wrapped[CAMPAIGN_MAX_ENTRIES];
void rewrapCampaign(float w, float l0, float emptyheight, vector theFontSize)
}
}
goto nottoolong;
-:toolong
+LABEL(toolong)
while(substring(r, strlen(r) - 1, 1) == "\n")
r = substring(r, 0, strlen(r) - 1);
r = strcat(r, "...\n");
-:nottoolong
+LABEL(nottoolong)
campaign_longdesc_wrapped[i] = strzone(substring(r, 0, strlen(r) - 1));
}
}
return SUPER(XonoticCampaignList).keyDown(me, scan, ascii, shift);
return 1;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticCampaignList, XonoticListBox)
+ METHOD(XonoticCampaignList, configureXonoticCampaignList, void(entity));
+ ATTRIB(XonoticCampaignList, rowsPerItem, float, 10)
+ METHOD(XonoticCampaignList, draw, void(entity));
+ METHOD(XonoticCampaignList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticCampaignList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticCampaignList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticCampaignList, setSelected, void(entity, float));
+ METHOD(XonoticCampaignList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticCampaignList, campaignGo, void(entity, float));
+ METHOD(XonoticCampaignList, destroy, void(entity));
+
+ ATTRIB(XonoticCampaignList, campaignGlob, float, 0)
+ ATTRIB(XonoticCampaignList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticCampaignList, columnPreviewOrigin, float, 0)
+ ATTRIB(XonoticCampaignList, columnPreviewSize, float, 0)
+ ATTRIB(XonoticCampaignList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticCampaignList, columnNameSize, float, 0)
+ ATTRIB(XonoticCampaignList, columnCheckMarkOrigin, float, 0)
+ ATTRIB(XonoticCampaignList, columnCheckMarkSize, float, 0)
+ ATTRIB(XonoticCampaignList, checkMarkOrigin, vector, '0 0 0')
+ ATTRIB(XonoticCampaignList, checkMarkSize, vector, '0 0 0')
+ ATTRIB(XonoticCampaignList, realUpperMargin1, float, 0)
+ ATTRIB(XonoticCampaignList, realUpperMargin2, float, 0)
+
+ ATTRIB(XonoticCampaignList, origin, vector, '0 0 0')
+ ATTRIB(XonoticCampaignList, itemAbsSize, vector, '0 0 0')
+ ATTRIB(XonoticCampaignList, emptyLineHeight, float, 0.5)
+
+ ATTRIB(XonoticCampaignList, campaignIndex, float, 0)
+ ATTRIB(XonoticCampaignList, cvarName, string, string_null)
+ METHOD(XonoticCampaignList, loadCvars, void(entity));
+ METHOD(XonoticCampaignList, saveCvars, void(entity));
+
+ ATTRIB(XonoticCampaignList, buttonNext, entity, NULL)
+ ATTRIB(XonoticCampaignList, buttonPrev, entity, NULL)
+ ATTRIB(XonoticCampaignList, labelTitle, entity, NULL)
+ENDCLASS(XonoticCampaignList)
+entity makeXonoticCampaignList();
+void CampaignList_LoadMap(entity btn, entity me);
+void MultiCampaign_Next(entity btn, entity me);
+void MultiCampaign_Prev(entity btn, entity me);
-#ifndef CHARMAP_H
-#define CHARMAP_H
-#include "picker.qc"
-CLASS(XonoticCharmap, XonoticPicker)
- METHOD(XonoticCharmap, configureXonoticCharmap, void(entity, entity));
- METHOD(XonoticCharmap, focusLeave, void(entity));
- METHOD(XonoticCharmap, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticCharmap, keyDown, float(entity, float, float, float));
- ATTRIB(XonoticCharmap, inputBox, entity, NULL)
- ATTRIB(XonoticCharmap, realFontSize, vector, '0 0 0')
-
- ATTRIB(XonoticCharmap, rows, float, 10)
- ATTRIB(XonoticCharmap, columns, float, 14)
-
- METHOD(XonoticCharmap, cellSelect, void(entity, vector));
- METHOD(XonoticCharmap, cellIsValid, bool(entity, vector));
- METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector));
- ATTRIB(XonoticCharmap, charOffset, vector, '0 0 0')
-ENDCLASS(XonoticCharmap)
-entity makeXonoticCharmap(entity controlledInputBox);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "charmap.qh"
+
+#include "inputbox.qh"
string CHARMAP =
"★◆■▮▰▬◣◤◥◢◀▲▶▼"
{
me.inputBox.saveCvars(me.inputBox);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "picker.qh"
+CLASS(XonoticCharmap, XonoticPicker)
+ METHOD(XonoticCharmap, configureXonoticCharmap, void(entity, entity));
+ METHOD(XonoticCharmap, focusLeave, void(entity));
+ METHOD(XonoticCharmap, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticCharmap, keyDown, float(entity, float, float, float));
+ ATTRIB(XonoticCharmap, inputBox, entity, NULL)
+ ATTRIB(XonoticCharmap, realFontSize, vector, '0 0 0')
+
+ ATTRIB(XonoticCharmap, rows, float, 10)
+ ATTRIB(XonoticCharmap, columns, float, 14)
+
+ METHOD(XonoticCharmap, cellSelect, void(entity, vector));
+ METHOD(XonoticCharmap, cellIsValid, bool(entity, vector));
+ METHOD(XonoticCharmap, cellDraw, void(entity, vector, vector));
+ ATTRIB(XonoticCharmap, charOffset, vector, '0 0 0')
+ENDCLASS(XonoticCharmap)
+entity makeXonoticCharmap(entity controlledInputBox);
-#ifndef CHECKBOX_H
-#define CHECKBOX_H
-#include "../item/checkbox.qc"
-CLASS(XonoticCheckBox, CheckBox)
- METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string, string));
- METHOD(XonoticCheckBox, setChecked, void(entity, float));
- ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
- ATTRIB(XonoticCheckBox, yesValue, float, 1)
- ATTRIB(XonoticCheckBox, noValue, float, 0)
+#include "checkbox.qh"
- ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
- ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
- ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
- ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
- ATTRIB(XonoticCheckBox, cvarName, string, string_null)
- METHOD(XonoticCheckBox, loadCvars, void(entity));
- METHOD(XonoticCheckBox, saveCvars, void(entity));
- ATTRIB(XonoticCheckBox, sendCvars, float, 0)
-
- ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBox)
-entity makeXonoticCheckBox_T(float, string, string, string);
-entity makeXonoticCheckBox(float, string, string);
-entity makeXonoticCheckBoxEx_T(float, float, string, string, string);
-entity makeXonoticCheckBoxEx(float, float, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
{
float y, n;
CheckSendCvars(me, me.cvarName);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticCheckBox, CheckBox)
+ METHOD(XonoticCheckBox, configureXonoticCheckBox, void(entity, float, float, string, string, string));
+ METHOD(XonoticCheckBox, setChecked, void(entity, float));
+ ATTRIB(XonoticCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticCheckBox, image, string, SKINGFX_CHECKBOX)
+ ATTRIB(XonoticCheckBox, yesValue, float, 1)
+ ATTRIB(XonoticCheckBox, noValue, float, 0)
+
+ ATTRIB(XonoticCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
+ ATTRIB(XonoticCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
+ ATTRIB(XonoticCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
+ ATTRIB(XonoticCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+ ATTRIB(XonoticCheckBox, cvarName, string, string_null)
+ METHOD(XonoticCheckBox, loadCvars, void(entity));
+ METHOD(XonoticCheckBox, saveCvars, void(entity));
+ ATTRIB(XonoticCheckBox, sendCvars, float, 0)
+
+ ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBox)
+entity makeXonoticCheckBox_T(float, string, string, string);
+entity makeXonoticCheckBox(float, string, string);
+entity makeXonoticCheckBoxEx_T(float, float, string, string, string);
+entity makeXonoticCheckBoxEx(float, float, string, string);
-#ifndef CHECKBOX_SLIDER_INVALID_H
-#define CHECKBOX_SLIDER_INVALID_H
-#include "../item/checkbox.qc"
-CLASS(XonoticSliderCheckBox, CheckBox)
- METHOD(XonoticSliderCheckBox, configureXonoticSliderCheckBox, void(entity, float, float, entity, string));
- METHOD(XonoticSliderCheckBox, setChecked, void(entity, float));
- METHOD(XonoticSliderCheckBox, draw, void(entity));
- ATTRIB(XonoticSliderCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticSliderCheckBox, image, string, SKINGFX_CHECKBOX)
+#include "checkbox_slider_invalid.qh"
- ATTRIB(XonoticSliderCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
- ATTRIB(XonoticSliderCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
- ATTRIB(XonoticSliderCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
- ATTRIB(XonoticSliderCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+#include "slider.qh"
- ATTRIB(XonoticSliderCheckBox, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticSliderCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
-
- ATTRIB(XonoticSliderCheckBox, controlledSlider, entity, NULL)
- ATTRIB(XonoticSliderCheckBox, offValue, float, -1)
- ATTRIB(XonoticSliderCheckBox, inverted, float, 0)
- ATTRIB(XonoticSliderCheckBox, savedValue, float, -1)
-ENDCLASS(XonoticSliderCheckBox)
-entity makeXonoticSliderCheckBox(float, float, entity, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticSliderCheckBox(float theOffValue, float isInverted, entity theControlledSlider, string theText)
{
entity me;
else
me.controlledSlider.setValue(me.controlledSlider, me.offValue);
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticSliderCheckBox, CheckBox)
+ METHOD(XonoticSliderCheckBox, configureXonoticSliderCheckBox, void(entity, float, float, entity, string));
+ METHOD(XonoticSliderCheckBox, setChecked, void(entity, float));
+ METHOD(XonoticSliderCheckBox, draw, void(entity));
+ ATTRIB(XonoticSliderCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticSliderCheckBox, image, string, SKINGFX_CHECKBOX)
+
+ ATTRIB(XonoticSliderCheckBox, color, vector, SKINCOLOR_CHECKBOX_N)
+ ATTRIB(XonoticSliderCheckBox, colorC, vector, SKINCOLOR_CHECKBOX_C)
+ ATTRIB(XonoticSliderCheckBox, colorF, vector, SKINCOLOR_CHECKBOX_F)
+ ATTRIB(XonoticSliderCheckBox, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+ ATTRIB(XonoticSliderCheckBox, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticSliderCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+
+ ATTRIB(XonoticSliderCheckBox, controlledSlider, entity, NULL)
+ ATTRIB(XonoticSliderCheckBox, offValue, float, -1)
+ ATTRIB(XonoticSliderCheckBox, inverted, float, 0)
+ ATTRIB(XonoticSliderCheckBox, savedValue, float, -1)
+ENDCLASS(XonoticSliderCheckBox)
+entity makeXonoticSliderCheckBox(float, float, entity, string);
-#ifndef CHECKBOX_STRING_H
-#define CHECKBOX_STRING_H
-#include "../item/checkbox.qc"
-CLASS(XonoticCheckBoxString, CheckBox)
- METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string));
- METHOD(XonoticCheckBoxString, setChecked, void(entity, float));
- ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
- ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
- ATTRIB(XonoticCheckBoxString, noString, string, string_null)
+#include "checkbox_string.qh"
- ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
- ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
- ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
- ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
-
- ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
- METHOD(XonoticCheckBoxString, loadCvars, void(entity));
- METHOD(XonoticCheckBoxString, saveCvars, void(entity));
- ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
-
- ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCheckBoxString)
-entity makeXonoticCheckBoxString(string, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticCheckBoxString(string theYesValue, string theNoValue, string theCvar, string theText)
{
entity me;
CheckSendCvars(me, me.cvarName);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticCheckBoxString, CheckBox)
+ METHOD(XonoticCheckBoxString, configureXonoticCheckBoxString, void(entity, string, string, string, string));
+ METHOD(XonoticCheckBoxString, setChecked, void(entity, float));
+ ATTRIB(XonoticCheckBoxString, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticCheckBoxString, image, string, SKINGFX_CHECKBOX)
+ ATTRIB(XonoticCheckBoxString, yesString, string, string_null)
+ ATTRIB(XonoticCheckBoxString, noString, string, string_null)
+
+ ATTRIB(XonoticCheckBoxString, color, vector, SKINCOLOR_CHECKBOX_N)
+ ATTRIB(XonoticCheckBoxString, colorC, vector, SKINCOLOR_CHECKBOX_C)
+ ATTRIB(XonoticCheckBoxString, colorF, vector, SKINCOLOR_CHECKBOX_F)
+ ATTRIB(XonoticCheckBoxString, colorD, vector, SKINCOLOR_CHECKBOX_D)
+
+ ATTRIB(XonoticCheckBoxString, cvarName, string, string_null)
+ METHOD(XonoticCheckBoxString, loadCvars, void(entity));
+ METHOD(XonoticCheckBoxString, saveCvars, void(entity));
+ ATTRIB(XonoticCheckBoxString, sendCvars, float, 0)
+
+ ATTRIB(XonoticCheckBoxString, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticCheckBoxString, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCheckBoxString)
+entity makeXonoticCheckBoxString(string, string, string, string);
-#ifndef COLORBUTTON_H
-#define COLORBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticColorButton, RadioButton)
- METHOD(XonoticColorButton, configureXonoticColorButton, void(entity, float, float, float));
- METHOD(XonoticColorButton, setChecked, void(entity, float));
- METHOD(XonoticColorButton, draw, void(entity));
- ATTRIB(XonoticColorButton, fontSize, float, 0)
- ATTRIB(XonoticColorButton, image, string, SKINGFX_COLORBUTTON)
+#include "colorbutton.qh"
- ATTRIB(XonoticColorButton, useDownAsChecked, float, 1)
-
- ATTRIB(XonoticColorButton, cvarPart, float, 0)
- ATTRIB(XonoticColorButton, cvarName, string, string_null)
- ATTRIB(XonoticColorButton, cvarValueFloat, float, 0)
- METHOD(XonoticColorButton, loadCvars, void(entity));
- METHOD(XonoticColorButton, saveCvars, void(entity));
-ENDCLASS(XonoticColorButton)
-entity makeXonoticColorButton(float, float, float);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticColorButton(float theGroup, float theColor, float theValue)
{
entity me;
me.colorD = me.color;
SUPER(XonoticColorButton).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/radiobutton.qh"
+CLASS(XonoticColorButton, RadioButton)
+ METHOD(XonoticColorButton, configureXonoticColorButton, void(entity, float, float, float));
+ METHOD(XonoticColorButton, setChecked, void(entity, float));
+ METHOD(XonoticColorButton, draw, void(entity));
+ ATTRIB(XonoticColorButton, fontSize, float, 0)
+ ATTRIB(XonoticColorButton, image, string, SKINGFX_COLORBUTTON)
+
+ ATTRIB(XonoticColorButton, useDownAsChecked, float, 1)
+
+ ATTRIB(XonoticColorButton, cvarPart, float, 0)
+ ATTRIB(XonoticColorButton, cvarName, string, string_null)
+ ATTRIB(XonoticColorButton, cvarValueFloat, float, 0)
+ METHOD(XonoticColorButton, loadCvars, void(entity));
+ METHOD(XonoticColorButton, saveCvars, void(entity));
+ENDCLASS(XonoticColorButton)
+entity makeXonoticColorButton(float, float, float);
-#ifndef COLORPICKER_H
-#define COLORPICKER_H
-#include "../item/image.qc"
-CLASS(XonoticColorpicker, Image)
- METHOD(XonoticColorpicker, configureXonoticColorpicker, void(entity, entity));
- METHOD(XonoticColorpicker, mousePress, float(entity, vector));
- METHOD(XonoticColorpicker, mouseRelease, float(entity, vector));
- METHOD(XonoticColorpicker, mouseDrag, float(entity, vector));
- ATTRIB(XonoticColorpicker, controlledTextbox, entity, NULL)
- ATTRIB(XonoticColorpicker, image, string, SKINGFX_COLORPICKER)
- ATTRIB(XonoticColorpicker, imagemargin, vector, SKINMARGIN_COLORPICKER)
- ATTRIB(XonoticColorpicker, focusable, float, 1)
- METHOD(XonoticColorpicker, focusLeave, void(entity));
- METHOD(XonoticColorpicker, keyDown, float(entity, float, float, float));
- METHOD(XonoticColorpicker, draw, void(entity));
-ENDCLASS(XonoticColorpicker)
-entity makeXonoticColorpicker(entity theTextbox);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "colorpicker.qh"
+
+#include "inputbox.qh"
+
entity makeXonoticColorpicker(entity theTextbox)
{
entity me;
draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, '0 0 0', aC);
draw_Picture(me.imgOrigin, strcat(me.src, "_m"), me.imgSize, me.color, B);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/image.qh"
+CLASS(XonoticColorpicker, Image)
+ METHOD(XonoticColorpicker, configureXonoticColorpicker, void(entity, entity));
+ METHOD(XonoticColorpicker, mousePress, float(entity, vector));
+ METHOD(XonoticColorpicker, mouseRelease, float(entity, vector));
+ METHOD(XonoticColorpicker, mouseDrag, float(entity, vector));
+ ATTRIB(XonoticColorpicker, controlledTextbox, entity, NULL)
+ ATTRIB(XonoticColorpicker, image, string, SKINGFX_COLORPICKER)
+ ATTRIB(XonoticColorpicker, imagemargin, vector, SKINMARGIN_COLORPICKER)
+ ATTRIB(XonoticColorpicker, focusable, float, 1)
+ METHOD(XonoticColorpicker, focusLeave, void(entity));
+ METHOD(XonoticColorpicker, keyDown, float(entity, float, float, float));
+ METHOD(XonoticColorpicker, draw, void(entity));
+ENDCLASS(XonoticColorpicker)
+entity makeXonoticColorpicker(entity theTextbox);
+
+vector color_hslimage(vector v, vector margin);
+vector hslimage_color(vector v, vector margin);
-#ifndef COLORPICKER_STRING_H
-#define COLORPICKER_STRING_H
-#include "../item/image.qc"
-CLASS(XonoticColorpickerString, Image)
- METHOD(XonoticColorpickerString, configureXonoticColorpickerString, void(entity, string, string));
- METHOD(XonoticColorpickerString, mousePress, float(entity, vector));
- METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector));
- METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector));
-
- ATTRIB(XonoticColorpickerString, cvarName, string, string_null)
- METHOD(XonoticColorpickerString, loadCvars, void(entity));
- METHOD(XonoticColorpickerString, saveCvars, void(entity));
-
- ATTRIB(XonoticColorpickerString, prevcoords, vector, '0 0 0')
- ATTRIB(XonoticColorpickerString, image, string, SKINGFX_COLORPICKER)
- ATTRIB(XonoticColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
- ATTRIB(XonoticColorpickerString, focusable, float, 1)
- METHOD(XonoticColorpickerString, draw, void(entity));
- ATTRIB(XonoticColorpickerString, disabledAlpha, float, 0.3)
-ENDCLASS(XonoticColorpickerString)
-entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "colorpicker_string.qh"
+
+.bool disabled;
+
entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar)
{
entity me;
draw_alpha = save;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "colorpicker.qh"
+
+#include "../item/image.qh"
+CLASS(XonoticColorpickerString, Image)
+ METHOD(XonoticColorpickerString, configureXonoticColorpickerString, void(entity, string, string));
+ METHOD(XonoticColorpickerString, mousePress, float(entity, vector));
+ METHOD(XonoticColorpickerString, mouseRelease, float(entity, vector));
+ METHOD(XonoticColorpickerString, mouseDrag, float(entity, vector));
+
+ ATTRIB(XonoticColorpickerString, cvarName, string, string_null)
+ METHOD(XonoticColorpickerString, loadCvars, void(entity));
+ METHOD(XonoticColorpickerString, saveCvars, void(entity));
+
+ ATTRIB(XonoticColorpickerString, prevcoords, vector, '0 0 0')
+ ATTRIB(XonoticColorpickerString, image, string, SKINGFX_COLORPICKER)
+ ATTRIB(XonoticColorpickerString, imagemargin, vector, SKINMARGIN_COLORPICKER)
+ ATTRIB(XonoticColorpickerString, focusable, float, 1)
+ METHOD(XonoticColorpickerString, draw, void(entity));
+ ATTRIB(XonoticColorpickerString, disabledAlpha, float, 0.3)
+ENDCLASS(XonoticColorpickerString)
+entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
-#ifndef COMMANDBUTTON_CLOSE
-# define COMMANDBUTTON_CLOSE 1
-# define COMMANDBUTTON_APPLY 2
-//# define COMMANDBUTTON_REVERT 4
-#endif
+#include "commandbutton.qh"
-#ifndef COMMANDBUTTON_H
-#define COMMANDBUTTON_H
-#include "button.qc"
-CLASS(XonoticCommandButton, XonoticButton)
- METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float, string));
- ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
- ATTRIB(XonoticCommandButton, flags, float, 0)
-ENDCLASS(XonoticCommandButton)
-entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
-entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float theFlags, string theTooltip)
{
entity me;
me.onClick = XonoticCommandButton_Click;
me.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "button.qh"
+CLASS(XonoticCommandButton, XonoticButton)
+ METHOD(XonoticCommandButton, configureXonoticCommandButton, void(entity, string, vector, string, float, string));
+ ATTRIB(XonoticCommandButton, onClickCommand, string, string_null)
+ ATTRIB(XonoticCommandButton, flags, float, 0)
+ENDCLASS(XonoticCommandButton)
+
+entity makeXonoticCommandButton_T(string theText, vector theColor, string theCommand, float closesMenu, string theTooltip);
+entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, float closesMenu);
+
+#ifndef COMMANDBUTTON_CLOSE
+# define COMMANDBUTTON_CLOSE 1
+# define COMMANDBUTTON_APPLY 2
+//# define COMMANDBUTTON_REVERT 4
+#endif
-#ifndef CREDITS_H
-#define CREDITS_H
+#include "credits.qh"
#define CREDITS(TITLE, FUNCTION, PERSON, PERSON_, NL) \
TITLE(_("Core Team")) \
#undef CREDITS
-#include "listbox.qc"
-CLASS(XonoticCreditsList, XonoticListBox)
- METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity));
- ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
- METHOD(XonoticCreditsList, draw, void(entity));
- METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float));
- METHOD(XonoticCreditsList, destroy, void(entity));
- ATTRIB(XonoticCreditsList, selectionDoesntMatter, bool, true)
-
- ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
- ATTRIB(XonoticCreditsList, bufferIndex, float, 0)
- ATTRIB(XonoticCreditsList, scrolling, float, 0)
-
- ATTRIB(XonoticCreditsList, alphaBG, float, 0)
-ENDCLASS(XonoticCreditsList)
-entity makeXonoticCreditsList();
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticCreditsList()
{
entity me;
me.scrolling = 0;
return SUPER(XonoticCreditsList).keyDown(me, key, ascii, shift);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticCreditsList, XonoticListBox)
+ METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity));
+ ATTRIB(XonoticCreditsList, rowsPerItem, float, 1)
+ METHOD(XonoticCreditsList, draw, void(entity));
+ METHOD(XonoticCreditsList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticCreditsList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticCreditsList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticCreditsList, destroy, void(entity));
+ ATTRIB(XonoticCreditsList, selectionDoesntMatter, bool, true)
+
+ ATTRIB(XonoticCreditsList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticCreditsList, realUpperMargin, float, 0)
+ ATTRIB(XonoticCreditsList, bufferIndex, float, 0)
+ ATTRIB(XonoticCreditsList, scrolling, float, 0)
+
+ ATTRIB(XonoticCreditsList, alphaBG, float, 0)
+ENDCLASS(XonoticCreditsList)
+entity makeXonoticCreditsList();
+
+int credits_get();
-#ifndef CROSSHAIRPICKER_H
-#define CROSSHAIRPICKER_H
-#include "picker.qc"
-CLASS(XonoticCrosshairPicker, XonoticPicker)
- METHOD(XonoticCrosshairPicker, configureXonoticCrosshairPicker, void(entity));
-
- ATTRIB(XonoticCrosshairPicker, rows, float, 3)
- ATTRIB(XonoticCrosshairPicker, columns, float, 12)
-
- METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector));
- METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector));
- METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector));
-ENDCLASS(XonoticCrosshairPicker)
-entity makeXonoticCrosshairPicker();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "crosshairpicker.qh"
string crosshairpicker_cellToCrosshair(entity me, vector cell)
{
if(cvar("crosshair_dot"))
draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "picker.qh"
+CLASS(XonoticCrosshairPicker, XonoticPicker)
+ METHOD(XonoticCrosshairPicker, configureXonoticCrosshairPicker, void(entity));
+
+ ATTRIB(XonoticCrosshairPicker, rows, float, 3)
+ ATTRIB(XonoticCrosshairPicker, columns, float, 12)
+
+ METHOD(XonoticCrosshairPicker, cellSelect, void(entity, vector));
+ METHOD(XonoticCrosshairPicker, cellIsValid, bool(entity, vector));
+ METHOD(XonoticCrosshairPicker, cellDraw, void(entity, vector, vector));
+ENDCLASS(XonoticCrosshairPicker)
+entity makeXonoticCrosshairPicker();
-#ifndef CROSSHAIRPREVIEW_H
-#define CROSSHAIRPREVIEW_H
-#include "../item.qc"
-CLASS(XonoticCrosshairPreview, Item)
- METHOD(XonoticCrosshairPreview, configureXonoticCrosshairPreview, void(entity));
- METHOD(XonoticCrosshairPreview, draw, void(entity));
- ATTRIB(XonoticCrosshairPreview, src, string, string_null)
- ATTRIB(XonoticCrosshairPreview, src2, string, string_null)
- ATTRIB(XonoticCrosshairPreview, disabled, float, 0)
- ATTRIB(XonoticCrosshairPreview, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticCrosshairPreview)
-entity makeXonoticCrosshairPreview();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "crosshairpreview.qh"
+
entity makeXonoticCrosshairPreview()
{
entity me;
SUPER(XonoticCrosshairPreview).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item.qh"
+CLASS(XonoticCrosshairPreview, Item)
+ METHOD(XonoticCrosshairPreview, configureXonoticCrosshairPreview, void(entity));
+ METHOD(XonoticCrosshairPreview, draw, void(entity));
+ ATTRIB(XonoticCrosshairPreview, src, string, string_null)
+ ATTRIB(XonoticCrosshairPreview, src2, string, string_null)
+ ATTRIB(XonoticCrosshairPreview, disabled, float, 0)
+ ATTRIB(XonoticCrosshairPreview, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticCrosshairPreview)
+entity makeXonoticCrosshairPreview();
-#ifndef CVARLIST_H
-#define CVARLIST_H
-#include "listbox.qc"
-CLASS(XonoticCvarList, XonoticListBox)
- METHOD(XonoticCvarList, configureXonoticCvarList, void(entity));
- ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
- METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticCvarList, keyDown, float(entity, float, float, float));
- METHOD(XonoticCvarList, showNotify, void(entity));
+#include "cvarlist.qh"
- METHOD(XonoticCvarList, destroy, void(entity));
+#include "inputbox.qh"
+#include "../item/container.qh"
- ATTRIB(XonoticCvarList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticCvarList, realUpperMargin, float, 0)
- ATTRIB(XonoticCvarList, columnNameOrigin, float, 0)
- ATTRIB(XonoticCvarList, columnNameSize, float, 0)
- ATTRIB(XonoticCvarList, columnValueOrigin, float, 0)
- ATTRIB(XonoticCvarList, columnValueSize, float, 0)
-
- METHOD(XonoticCvarList, mouseRelease, float(entity, vector));
- METHOD(XonoticCvarList, setSelected, void(entity, float));
- METHOD(XonoticCvarList, updateCvarType, float(entity));
-
- ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL)
- ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL)
- ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL)
- ATTRIB(XonoticCvarList, cvarTypeBox, entity, NULL)
- ATTRIB(XonoticCvarList, cvarValueBox, entity, NULL)
- ATTRIB(XonoticCvarList, cvarDefaultBox, entity, NULL)
- ATTRIB(XonoticCvarList, cvarNeedsForcing, float, 0)
-
- ATTRIB(XonoticCvarList, handle, float, -1)
- ATTRIB(XonoticCvarList, cvarName, string, string_null)
- ATTRIB(XonoticCvarList, cvarDescription, string, string_null)
- ATTRIB(XonoticCvarList, cvarType, string, string_null)
- ATTRIB(XonoticCvarList, cvarDefault, string, string_null)
-ENDCLASS(XonoticCvarList)
-entity makeXonoticCvarList();
-void CvarList_Filter_Change(entity box, entity me);
-void CvarList_Value_Change(entity box, entity me);
-void CvarList_Revert_Click(entity btn, entity me);
-void CvarList_End_Editing(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticCvarList()
{
entity me;
{
box.parent.setFocus(box.parent, me);
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticCvarList, XonoticListBox)
+ METHOD(XonoticCvarList, configureXonoticCvarList, void(entity));
+ ATTRIB(XonoticCvarList, rowsPerItem, float, 1)
+ METHOD(XonoticCvarList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticCvarList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticCvarList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticCvarList, showNotify, void(entity));
+
+ METHOD(XonoticCvarList, destroy, void(entity));
+
+ ATTRIB(XonoticCvarList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticCvarList, realUpperMargin, float, 0)
+ ATTRIB(XonoticCvarList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticCvarList, columnNameSize, float, 0)
+ ATTRIB(XonoticCvarList, columnValueOrigin, float, 0)
+ ATTRIB(XonoticCvarList, columnValueSize, float, 0)
+
+ METHOD(XonoticCvarList, mouseRelease, float(entity, vector));
+ METHOD(XonoticCvarList, setSelected, void(entity, float));
+ METHOD(XonoticCvarList, updateCvarType, float(entity));
+
+ ATTRIB(XonoticCvarList, controlledTextbox, entity, NULL)
+ ATTRIB(XonoticCvarList, cvarNameBox, entity, NULL)
+ ATTRIB(XonoticCvarList, cvarDescriptionBox, entity, NULL)
+ ATTRIB(XonoticCvarList, cvarTypeBox, entity, NULL)
+ ATTRIB(XonoticCvarList, cvarValueBox, entity, NULL)
+ ATTRIB(XonoticCvarList, cvarDefaultBox, entity, NULL)
+ ATTRIB(XonoticCvarList, cvarNeedsForcing, float, 0)
+
+ ATTRIB(XonoticCvarList, handle, float, -1)
+ ATTRIB(XonoticCvarList, cvarName, string, string_null)
+ ATTRIB(XonoticCvarList, cvarDescription, string, string_null)
+ ATTRIB(XonoticCvarList, cvarType, string, string_null)
+ ATTRIB(XonoticCvarList, cvarDefault, string, string_null)
+ENDCLASS(XonoticCvarList)
+entity makeXonoticCvarList();
+void CvarList_Filter_Change(entity box, entity me);
+void CvarList_Value_Change(entity box, entity me);
+void CvarList_Revert_Click(entity btn, entity me);
+void CvarList_End_Editing(entity box, entity me);
-#ifndef DATASOURCE_H
-#define DATASOURCE_H
-CLASS(DataSource, Object)
- entity DataSource_true;
- entity DataSource_false;
- INIT_STATIC(DataSource) {
- DataSource_true = NEW(Object);
- DataSource_false = NULL;
- }
- /**
- * get entry `i` passing `name` and `icon` through `returns` if it is not null
- * returns `DataSource_false` if out of bounds
- * otherwise returns an entity or `DataSource_true`
- */
- METHOD(DataSource, getEntry, entity(entity this, int i, void(string name, string icon) returns)) { return DataSource_false; }
- /** return the index of the first match for `find`. optional */
- METHOD(DataSource, indexOf, int(entity this, string find)) { return -1; }
- /** reload all entries matching `filter` returning how many matches were found */
- METHOD(DataSource, reload, int(entity this, string filter)) { return 0; }
- /** cleanup on shutdown. optional */
- METHOD(DataSource, destroy, void(entity this)) { }
-ENDCLASS(DataSource)
-
+#include "datasource.qh"
-CLASS(StringSource, DataSource)
- ATTRIB(StringSource, StringSource_str, string, string_null)
- ATTRIB(StringSource, StringSource_sep, string, string_null)
CONSTRUCTOR(StringSource, string str, string sep)
{
CONSTRUCT(StringSource);
{
return tokenizebyseparator(this.StringSource_str, this.StringSource_sep);
}
-ENDCLASS(StringSource)
-CLASS(CvarStringSource, StringSource)
- ATTRIB(CvarStringSource, CvarStringSource_cvar, string, string_null)
CONSTRUCTOR(CvarStringSource, string cv, string sep)
{
CONSTRUCT(CvarStringSource);
this.StringSource_str = s ? cvar_string(s) : string_null;
return SUPER(CvarStringSource).reload(this, filter);
}
-ENDCLASS(CvarStringSource)
-#endif
--- /dev/null
+#pragma once
+
+CLASS(DataSource, Object)
+ STATIC_ATTRIB(DataSource, true, entity, NEW(Object));
+ STATIC_ATTRIB(DataSource, false, entity, NULL);
+ /**
+ * get entry `i` passing `name` and `icon` through `returns` if it is not null
+ * returns `DataSource_false` if out of bounds
+ * otherwise returns an entity or `DataSource_true`
+ */
+ METHOD(DataSource, getEntry, entity(entity this, int i, void(string name, string icon) returns)) { return DataSource_false; }
+ /** return the index of the first match for `find`. optional */
+ METHOD(DataSource, indexOf, int(entity this, string find)) { return -1; }
+ /** reload all entries matching `filter` returning how many matches were found */
+ METHOD(DataSource, reload, int(entity this, string filter)) { return 0; }
+ /** cleanup on shutdown. optional */
+ METHOD(DataSource, destroy, void(entity this)) { }
+ENDCLASS(DataSource)
+
+
+CLASS(StringSource, DataSource)
+ ATTRIB(StringSource, StringSource_str, string, string_null)
+ ATTRIB(StringSource, StringSource_sep, string, string_null)
+ CONSTRUCTOR(StringSource, string str, string sep);
+ METHOD(StringSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
+ METHOD(StringSource, reload, int(entity this, string filter));
+ENDCLASS(StringSource)
+
+CLASS(CvarStringSource, StringSource)
+ ATTRIB(CvarStringSource, CvarStringSource_cvar, string, string_null)
+ CONSTRUCTOR(CvarStringSource, string cv, string sep);
+ METHOD(CvarStringSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
+ METHOD(CvarStringSource, reload, int(entity this, string filter));
+ENDCLASS(CvarStringSource)
-#ifndef DEMOLIST_H
-#define DEMOLIST_H
-#include "listbox.qc"
-CLASS(XonoticDemoList, XonoticListBox)
- METHOD(XonoticDemoList, configureXonoticDemoList, void(entity));
- ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
- METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticDemoList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticDemoList, getDemos, void(entity));
- METHOD(XonoticDemoList, startDemo, void(entity));
- METHOD(XonoticDemoList, timeDemo, void(entity));
- METHOD(XonoticDemoList, demoName, string(entity, float));
- METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticDemoList, keyDown, float(entity, float, float, float));
- METHOD(XonoticDemoList, destroy, void(entity));
- METHOD(XonoticDemoList, showNotify, void(entity));
-
- ATTRIB(XonoticDemoList, listDemo, float, -1)
- ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
- ATTRIB(XonoticDemoList, columnNameSize, float, 0)
- ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
- ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
- ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticDemoList, filterString, string, string_null)
-ENDCLASS(XonoticDemoList)
-
-#ifndef IMPLEMENTATION
-// public:
-entity demolist; // for reference elsewhere
-entity makeXonoticDemoList();
-#endif
-void DemoList_Refresh_Click(entity btn, entity me);
-void DemoList_Filter_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "demolist.qh"
+
+#include "inputbox.qh"
entity makeXonoticDemoList()
{
return SUPER(XonoticDemoList).keyDown(me, scan, ascii, shift);
}
}
-#endif
-
--- /dev/null
+#pragma once
+
+#include "mainwindow.qh"
+#include "listbox.qh"
+CLASS(XonoticDemoList, XonoticListBox)
+ METHOD(XonoticDemoList, configureXonoticDemoList, void(entity));
+ ATTRIB(XonoticDemoList, rowsPerItem, float, 1)
+ METHOD(XonoticDemoList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticDemoList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticDemoList, getDemos, void(entity));
+ METHOD(XonoticDemoList, startDemo, void(entity));
+ METHOD(XonoticDemoList, timeDemo, void(entity));
+ METHOD(XonoticDemoList, demoName, string(entity, float));
+ METHOD(XonoticDemoList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticDemoList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticDemoList, destroy, void(entity));
+ METHOD(XonoticDemoList, showNotify, void(entity));
+
+ ATTRIB(XonoticDemoList, listDemo, float, -1)
+ ATTRIB(XonoticDemoList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticDemoList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticDemoList, columnNameSize, float, 0)
+ ATTRIB(XonoticDemoList, realUpperMargin, float, 0)
+ ATTRIB(XonoticDemoList, origin, vector, '0 0 0')
+ ATTRIB(XonoticDemoList, itemAbsSize, vector, '0 0 0')
+
+ ATTRIB(XonoticDemoList, filterString, string, string_null)
+ENDCLASS(XonoticDemoList)
+
+entity demolist; // for reference elsewhere
+entity makeXonoticDemoList();
+void DemoList_Refresh_Click(entity btn, entity me);
+void DemoList_Filter_Change(entity box, entity me);
-#ifndef DIALOG_H
-#define DIALOG_H
-#include "../item/dialog.qc"
-CLASS(XonoticDialog, Dialog)
- // still to be customized by user
- /*
- ATTRIB(XonoticDialog, closable, float, 1)
- ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
- ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
- ATTRIB(XonoticDialog, intendedWidth, float, 0)
- ATTRIB(XonoticDialog, rows, float, 3)
- ATTRIB(XonoticDialog, columns, float, 2)
- */
- ATTRIB(XonoticDialog, marginTop, float, SKINMARGIN_TOP) // pixels
- ATTRIB(XonoticDialog, marginBottom, float, SKINMARGIN_BOTTOM) // pixels
- ATTRIB(XonoticDialog, marginLeft, float, SKINMARGIN_LEFT) // pixels
- ATTRIB(XonoticDialog, marginRight, float, SKINMARGIN_RIGHT) // pixels
- ATTRIB(XonoticDialog, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
- ATTRIB(XonoticDialog, rowSpacing, float, SKINMARGIN_ROWS) // pixels
- ATTRIB(XonoticDialog, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
- ATTRIB(XonoticDialog, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
- ATTRIB(XonoticDialog, titleFontSize, float, SKINFONTSIZE_TITLE) // pixels
+#include "dialog.qh"
- ATTRIB(XonoticDialog, backgroundImage, string, SKINGFX_DIALOGBORDER)
- ATTRIB(XonoticDialog, borderLines, float, SKINHEIGHT_DIALOGBORDER)
- ATTRIB(XonoticDialog, closeButtonImage, string, SKINGFX_CLOSEBUTTON)
- ATTRIB(XonoticDialog, zoomedOutTitleBarPosition, float, SKINHEIGHT_ZOOMEDTITLE * 0.5 - 0.5)
- ATTRIB(XonoticDialog, zoomedOutTitleBar, float, SKINHEIGHT_ZOOMEDTITLE != 0)
-
- ATTRIB(XonoticDialog, alpha, float, SKINALPHA_TEXT)
-
- METHOD(XonoticDialog, configureDialog, void(entity));
-ENDCLASS(XonoticDialog)
-#ifndef IMPLEMENTATION
-entity currentDialog;
-#endif
-#endif
-
-#ifdef IMPLEMENTATION
void XonoticDialog_configureDialog(entity me)
{
currentDialog = me;
SUPER(XonoticDialog).configureDialog(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/dialog.qh"
+CLASS(XonoticDialog, Dialog)
+ // still to be customized by user
+ /*
+ ATTRIB(XonoticDialog, closable, float, 1)
+ ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
+ ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
+ ATTRIB(XonoticDialog, intendedWidth, float, 0)
+ ATTRIB(XonoticDialog, rows, float, 3)
+ ATTRIB(XonoticDialog, columns, float, 2)
+ */
+ ATTRIB(XonoticDialog, marginTop, float, SKINMARGIN_TOP) // pixels
+ ATTRIB(XonoticDialog, marginBottom, float, SKINMARGIN_BOTTOM) // pixels
+ ATTRIB(XonoticDialog, marginLeft, float, SKINMARGIN_LEFT) // pixels
+ ATTRIB(XonoticDialog, marginRight, float, SKINMARGIN_RIGHT) // pixels
+ ATTRIB(XonoticDialog, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
+ ATTRIB(XonoticDialog, rowSpacing, float, SKINMARGIN_ROWS) // pixels
+ ATTRIB(XonoticDialog, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+ ATTRIB(XonoticDialog, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
+ ATTRIB(XonoticDialog, titleFontSize, float, SKINFONTSIZE_TITLE) // pixels
+
+ ATTRIB(XonoticDialog, backgroundImage, string, SKINGFX_DIALOGBORDER)
+ ATTRIB(XonoticDialog, borderLines, float, SKINHEIGHT_DIALOGBORDER)
+ ATTRIB(XonoticDialog, closeButtonImage, string, SKINGFX_CLOSEBUTTON)
+ ATTRIB(XonoticDialog, zoomedOutTitleBarPosition, float, SKINHEIGHT_ZOOMEDTITLE * 0.5 - 0.5)
+ ATTRIB(XonoticDialog, zoomedOutTitleBar, float, SKINHEIGHT_ZOOMEDTITLE != 0)
+
+ ATTRIB(XonoticDialog, alpha, float, SKINALPHA_TEXT)
+
+ METHOD(XonoticDialog, configureDialog, void(entity));
+ENDCLASS(XonoticDialog)
+
+entity currentDialog;
-#ifndef DIALOG_CREDITS_H
-#define DIALOG_CREDITS_H
-#include "dialog.qc"
-CLASS(XonoticCreditsDialog, XonoticDialog)
- METHOD(XonoticCreditsDialog, fill, void(entity));
- METHOD(XonoticCreditsDialog, focusEnter, void(entity));
- ATTRIB(XonoticCreditsDialog, title, string, _("Credits"))
- ATTRIB(XonoticCreditsDialog, tooltip, string, _("The Xonotic credits"))
- ATTRIB(XonoticCreditsDialog, color, vector, SKINCOLOR_DIALOG_CREDITS)
- ATTRIB(XonoticCreditsDialog, intendedWidth, float, SKINWIDTH_CREDITS)
- ATTRIB(XonoticCreditsDialog, rows, float, SKINROWS_CREDITS)
- ATTRIB(XonoticCreditsDialog, columns, float, 2)
- ATTRIB(XonoticCreditsDialog, creditsList, entity, NULL)
-ENDCLASS(XonoticCreditsDialog)
-#endif
+#include "dialog_credits.qh"
+
+#include "credits.qh"
+#include "button.qh"
+#include "../item/dialog.qh"
-#ifdef IMPLEMENTATION
void XonoticCreditsDialog_fill(entity me)
{
entity e;
{
me.creditsList.scrolling = time + 1;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticCreditsDialog, XonoticDialog)
+ METHOD(XonoticCreditsDialog, fill, void(entity));
+ METHOD(XonoticCreditsDialog, focusEnter, void(entity));
+ ATTRIB(XonoticCreditsDialog, title, string, _("Credits"))
+ ATTRIB(XonoticCreditsDialog, tooltip, string, _("The Xonotic credits"))
+ ATTRIB(XonoticCreditsDialog, color, vector, SKINCOLOR_DIALOG_CREDITS)
+ ATTRIB(XonoticCreditsDialog, intendedWidth, float, SKINWIDTH_CREDITS)
+ ATTRIB(XonoticCreditsDialog, rows, float, SKINROWS_CREDITS)
+ ATTRIB(XonoticCreditsDialog, columns, float, 2)
+ ATTRIB(XonoticCreditsDialog, creditsList, entity, NULL)
+ENDCLASS(XonoticCreditsDialog)
-#ifndef DIALOG_FIRSTRUN_H
-#define DIALOG_FIRSTRUN_H
-#include "rootdialog.qc"
-CLASS(XonoticFirstRunDialog, XonoticRootDialog)
- METHOD(XonoticFirstRunDialog, fill, void(entity));
- ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
- ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
- ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.7)
- ATTRIB(XonoticFirstRunDialog, rows, float, 16)
- ATTRIB(XonoticFirstRunDialog, columns, float, 6)
- ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
- ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
- ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
+#include "dialog_firstrun.qh"
- ATTRIB(XonoticFirstRunDialog, closable, float, 0)
-ENDCLASS(XonoticFirstRunDialog)
-#endif
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "languagelist.qh"
+#include "radiobutton.qh"
+#include "colorpicker.qh"
+#include "charmap.qh"
+#include "commandbutton.qh"
-#ifdef IMPLEMENTATION
float CheckFirstRunButton(entity me)
{
if(cvar_string("_cl_name") != cvar_defstring("_cl_name"))
me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart", COMMANDBUTTON_APPLY));
setDependentWeird(e, CheckFirstRunButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticFirstRunDialog, XonoticRootDialog)
+ METHOD(XonoticFirstRunDialog, fill, void(entity));
+ ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
+ ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
+ ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.7)
+ ATTRIB(XonoticFirstRunDialog, rows, float, 16)
+ ATTRIB(XonoticFirstRunDialog, columns, float, 6)
+ ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
+ ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
+ ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
+
+ ATTRIB(XonoticFirstRunDialog, closable, float, 0)
+ENDCLASS(XonoticFirstRunDialog)
-#ifndef DIALOG_HUDPANEL_AMMO_H
-#define DIALOG_HUDPANEL_AMMO_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDAmmoDialog, XonoticRootDialog)
- METHOD(XonoticHUDAmmoDialog, fill, void(entity));
- ATTRIB(XonoticHUDAmmoDialog, title, string, _("Ammo Panel"))
- ATTRIB(XonoticHUDAmmoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDAmmoDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDAmmoDialog, rows, float, 15)
- ATTRIB(XonoticHUDAmmoDialog, columns, float, 4)
- ATTRIB(XonoticHUDAmmoDialog, name, string, "HUDammo")
- ATTRIB(XonoticHUDAmmoDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDAmmoDialog)
-#endif
+#include "dialog_hudpanel_ammo.qh"
+
+#include "slider.qh"
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDAmmoDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "0", _("Left")));
me.TD(me, 1, 2.6/2, e = makeXonoticRadioButton(2, "hud_panel_ammo_iconalign", "1", _("Right")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDAmmoDialog, XonoticRootDialog)
+ METHOD(XonoticHUDAmmoDialog, fill, void(entity));
+ ATTRIB(XonoticHUDAmmoDialog, title, string, _("Ammo Panel"))
+ ATTRIB(XonoticHUDAmmoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDAmmoDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDAmmoDialog, rows, float, 15)
+ ATTRIB(XonoticHUDAmmoDialog, columns, float, 4)
+ ATTRIB(XonoticHUDAmmoDialog, name, string, "HUDammo")
+ ATTRIB(XonoticHUDAmmoDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDAmmoDialog)
-#ifndef DIALOG_HUDPANEL_CENTERPRINT_H
-#define DIALOG_HUDPANEL_CENTERPRINT_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDCenterprintDialog, XonoticRootDialog)
- METHOD(XonoticHUDCenterprintDialog, fill, void(entity));
- ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel"))
- ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDCenterprintDialog, rows, float, 15)
- ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4)
- ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint")
- ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDCenterprintDialog)
-#endif
+#include "dialog_hudpanel_centerprint.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDCenterprintDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Font scale:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 2, 0.1, "hud_panel_centerprint_fontscale"));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDCenterprintDialog, XonoticRootDialog)
+ METHOD(XonoticHUDCenterprintDialog, fill, void(entity));
+ ATTRIB(XonoticHUDCenterprintDialog, title, string, _("Centerprint Panel"))
+ ATTRIB(XonoticHUDCenterprintDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDCenterprintDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDCenterprintDialog, rows, float, 15)
+ ATTRIB(XonoticHUDCenterprintDialog, columns, float, 4)
+ ATTRIB(XonoticHUDCenterprintDialog, name, string, "HUDcenterprint")
+ ATTRIB(XonoticHUDCenterprintDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDCenterprintDialog)
-#ifndef DIALOG_HUDPANEL_CHAT_H
-#define DIALOG_HUDPANEL_CHAT_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDChatDialog, XonoticRootDialog)
- METHOD(XonoticHUDChatDialog, fill, void(entity));
- ATTRIB(XonoticHUDChatDialog, title, string, _("Chat Panel"))
- ATTRIB(XonoticHUDChatDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDChatDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDChatDialog, rows, float, 15)
- ATTRIB(XonoticHUDChatDialog, columns, float, 4)
- ATTRIB(XonoticHUDChatDialog, name, string, "HUDchat")
- ATTRIB(XonoticHUDChatDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDChatDialog)
-#endif
+#include "dialog_hudpanel_chat.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDChatDialog_fill(entity me)
{
entity e;
me.TDempty(me, 0.2);
me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "con_chatsound", _("Chat beep sound")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDChatDialog, XonoticRootDialog)
+ METHOD(XonoticHUDChatDialog, fill, void(entity));
+ ATTRIB(XonoticHUDChatDialog, title, string, _("Chat Panel"))
+ ATTRIB(XonoticHUDChatDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDChatDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDChatDialog, rows, float, 15)
+ ATTRIB(XonoticHUDChatDialog, columns, float, 4)
+ ATTRIB(XonoticHUDChatDialog, name, string, "HUDchat")
+ ATTRIB(XonoticHUDChatDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDChatDialog)
-#ifndef DIALOG_HUDPANEL_ENGINEINFO_H
-#define DIALOG_HUDPANEL_ENGINEINFO_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDEngineInfoDialog, XonoticRootDialog)
- METHOD(XonoticHUDEngineInfoDialog, fill, void(entity));
- ATTRIB(XonoticHUDEngineInfoDialog, title, string, _("Engine Info Panel"))
- ATTRIB(XonoticHUDEngineInfoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDEngineInfoDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDEngineInfoDialog, rows, float, 15)
- ATTRIB(XonoticHUDEngineInfoDialog, columns, float, 4)
- ATTRIB(XonoticHUDEngineInfoDialog, name, string, "HUDengineinfo")
- ATTRIB(XonoticHUDEngineInfoDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDEngineInfoDialog)
-#endif
+#include "dialog_hudpanel_engineinfo.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDEngineInfoDialog_fill(entity me)
{
entity e;
me.TDempty(me, 0.2);
me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_engineinfo_framecounter_exponentialmovingaverage", _("Use an averaging algorithm for fps")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDEngineInfoDialog, XonoticRootDialog)
+ METHOD(XonoticHUDEngineInfoDialog, fill, void(entity));
+ ATTRIB(XonoticHUDEngineInfoDialog, title, string, _("Engine Info Panel"))
+ ATTRIB(XonoticHUDEngineInfoDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDEngineInfoDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDEngineInfoDialog, rows, float, 15)
+ ATTRIB(XonoticHUDEngineInfoDialog, columns, float, 4)
+ ATTRIB(XonoticHUDEngineInfoDialog, name, string, "HUDengineinfo")
+ ATTRIB(XonoticHUDEngineInfoDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDEngineInfoDialog)
-#ifndef DIALOG_HUDPANEL_HEALTHARMOR_H
-#define DIALOG_HUDPANEL_HEALTHARMOR_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDHealthArmorDialog, XonoticRootDialog)
- METHOD(XonoticHUDHealthArmorDialog, fill, void(entity));
- ATTRIB(XonoticHUDHealthArmorDialog, title, string, _("Health/Armor Panel"))
- ATTRIB(XonoticHUDHealthArmorDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDHealthArmorDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDHealthArmorDialog, rows, float, 15)
- ATTRIB(XonoticHUDHealthArmorDialog, columns, float, 4)
- ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
- ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDHealthArmorDialog)
-#endif
+#include "dialog_hudpanel_healtharmor.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDHealthArmorDialog_fill(entity me)
{
entity e;
me.TR(me);
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_healtharmor_flip", _("Flip health and armor positions")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDHealthArmorDialog, XonoticRootDialog)
+ METHOD(XonoticHUDHealthArmorDialog, fill, void(entity));
+ ATTRIB(XonoticHUDHealthArmorDialog, title, string, _("Health/Armor Panel"))
+ ATTRIB(XonoticHUDHealthArmorDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDHealthArmorDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDHealthArmorDialog, rows, float, 15)
+ ATTRIB(XonoticHUDHealthArmorDialog, columns, float, 4)
+ ATTRIB(XonoticHUDHealthArmorDialog, name, string, "HUDhealtharmor")
+ ATTRIB(XonoticHUDHealthArmorDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDHealthArmorDialog)
-#ifndef DIALOG_HUDPANEL_INFOMESSAGES_H
-#define DIALOG_HUDPANEL_INFOMESSAGES_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDInfoMessagesDialog, XonoticRootDialog)
- METHOD(XonoticHUDInfoMessagesDialog, fill, void(entity));
- ATTRIB(XonoticHUDInfoMessagesDialog, title, string, _("Info Messages Panel"))
- ATTRIB(XonoticHUDInfoMessagesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDInfoMessagesDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDInfoMessagesDialog, rows, float, 15)
- ATTRIB(XonoticHUDInfoMessagesDialog, columns, float, 4)
- ATTRIB(XonoticHUDInfoMessagesDialog, name, string, "HUDinfomessages")
- ATTRIB(XonoticHUDInfoMessagesDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDInfoMessagesDialog)
-#endif
+#include "dialog_hudpanel_infomessages.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDInfoMessagesDialog_fill(entity me)
{
entity e;
me.TDempty(me, 0.2);
me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_infomessages_flip", _("Flip align")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDInfoMessagesDialog, XonoticRootDialog)
+ METHOD(XonoticHUDInfoMessagesDialog, fill, void(entity));
+ ATTRIB(XonoticHUDInfoMessagesDialog, title, string, _("Info Messages Panel"))
+ ATTRIB(XonoticHUDInfoMessagesDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDInfoMessagesDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDInfoMessagesDialog, rows, float, 15)
+ ATTRIB(XonoticHUDInfoMessagesDialog, columns, float, 4)
+ ATTRIB(XonoticHUDInfoMessagesDialog, name, string, "HUDinfomessages")
+ ATTRIB(XonoticHUDInfoMessagesDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDInfoMessagesDialog)
-#ifndef DIALOG_HUDPANEL_ITEMSTIME_H
-#define DIALOG_HUDPANEL_ITEMSTIME_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDItemsTimeDialog, XonoticRootDialog)
- METHOD(XonoticHUDItemsTimeDialog, fill, void(entity));
- ATTRIB(XonoticHUDItemsTimeDialog, title, string, _("Items Time Panel"))
- ATTRIB(XonoticHUDItemsTimeDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDItemsTimeDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDItemsTimeDialog, rows, float, 15)
- ATTRIB(XonoticHUDItemsTimeDialog, columns, float, 4)
- ATTRIB(XonoticHUDItemsTimeDialog, name, string, "HUDitemstime")
-ENDCLASS(XonoticHUDItemsTimeDialog)
-#endif
+#include "dialog_hudpanel_itemstime.qh"
+
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "radiobutton.qh"
+#include "checkbox.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDItemsTimeDialog_fill(entity me)
{
entity e;
me.TR(me);
me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_itemstime_dynamicsize", _("Dynamic size")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDItemsTimeDialog, XonoticRootDialog)
+ METHOD(XonoticHUDItemsTimeDialog, fill, void(entity));
+ ATTRIB(XonoticHUDItemsTimeDialog, title, string, _("Items Time Panel"))
+ ATTRIB(XonoticHUDItemsTimeDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDItemsTimeDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDItemsTimeDialog, rows, float, 15)
+ ATTRIB(XonoticHUDItemsTimeDialog, columns, float, 4)
+ ATTRIB(XonoticHUDItemsTimeDialog, name, string, "HUDitemstime")
+ENDCLASS(XonoticHUDItemsTimeDialog)
-#ifndef DIALOG_HUDPANEL_MODICONS_H
-#define DIALOG_HUDPANEL_MODICONS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDModIconsDialog, XonoticRootDialog)
- METHOD(XonoticHUDModIconsDialog, fill, void(entity));
- ATTRIB(XonoticHUDModIconsDialog, title, string, _("Mod Icons Panel"))
- ATTRIB(XonoticHUDModIconsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDModIconsDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDModIconsDialog, rows, float, 15)
- ATTRIB(XonoticHUDModIconsDialog, columns, float, 4)
- ATTRIB(XonoticHUDModIconsDialog, name, string, "HUDmodicons")
- ATTRIB(XonoticHUDModIconsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDModIconsDialog)
-#endif
+#include "dialog_hudpanel_modicons.qh"
+
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDModIconsDialog_fill(entity me)
{
entity e;
DIALOG_HUDPANEL_COMMON();
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDModIconsDialog, XonoticRootDialog)
+ METHOD(XonoticHUDModIconsDialog, fill, void(entity));
+ ATTRIB(XonoticHUDModIconsDialog, title, string, _("Mod Icons Panel"))
+ ATTRIB(XonoticHUDModIconsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDModIconsDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDModIconsDialog, rows, float, 15)
+ ATTRIB(XonoticHUDModIconsDialog, columns, float, 4)
+ ATTRIB(XonoticHUDModIconsDialog, name, string, "HUDmodicons")
+ ATTRIB(XonoticHUDModIconsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDModIconsDialog)
-#ifndef DIALOG_HUDPANEL_NOTIFICATION_H
-#define DIALOG_HUDPANEL_NOTIFICATION_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDNotificationDialog, XonoticRootDialog)
- METHOD(XonoticHUDNotificationDialog, fill, void(entity));
- ATTRIB(XonoticHUDNotificationDialog, title, string, _("Notification Panel"))
- ATTRIB(XonoticHUDNotificationDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDNotificationDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDNotificationDialog, rows, float, 15)
- ATTRIB(XonoticHUDNotificationDialog, columns, float, 4)
- ATTRIB(XonoticHUDNotificationDialog, name, string, "HUDnotify")
- ATTRIB(XonoticHUDNotificationDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDNotificationDialog)
-#endif
+#include "dialog_hudpanel_notification.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDNotificationDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Entry fadetime:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(0.5, 5, 0.5, "hud_panel_notify_fadetime"));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDNotificationDialog, XonoticRootDialog)
+ METHOD(XonoticHUDNotificationDialog, fill, void(entity));
+ ATTRIB(XonoticHUDNotificationDialog, title, string, _("Notification Panel"))
+ ATTRIB(XonoticHUDNotificationDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDNotificationDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDNotificationDialog, rows, float, 15)
+ ATTRIB(XonoticHUDNotificationDialog, columns, float, 4)
+ ATTRIB(XonoticHUDNotificationDialog, name, string, "HUDnotify")
+ ATTRIB(XonoticHUDNotificationDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDNotificationDialog)
-#ifndef DIALOG_HUDPANEL_PHYSICS_H
-#define DIALOG_HUDPANEL_PHYSICS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDPhysicsDialog, XonoticRootDialog)
- METHOD(XonoticHUDPhysicsDialog, fill, void(entity));
- ATTRIB(XonoticHUDPhysicsDialog, title, string, _("Physics Panel"))
- ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
- ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
- ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
- ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
- ATTRIB(XonoticHUDPhysicsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDPhysicsDialog)
-#endif
+#include "dialog_hudpanel_physics.qh"
+
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "checkbox.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDPhysicsDialog_fill(entity me)
{
entity e;
// me.TD(me, 1, 0.6, e = makeXonoticInputBox(1, "hud_panel_physics_acceleration_max"));
// setDependent(e, "hud_panel_physics_progressbar", 1, 1);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPhysicsDialog, XonoticRootDialog)
+ METHOD(XonoticHUDPhysicsDialog, fill, void(entity));
+ ATTRIB(XonoticHUDPhysicsDialog, title, string, _("Physics Panel"))
+ ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
+ ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
+ ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
+ ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
+ ATTRIB(XonoticHUDPhysicsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPhysicsDialog)
-#ifndef DIALOG_HUDPANEL_POWERUPS_H
-#define DIALOG_HUDPANEL_POWERUPS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDPowerupsDialog, XonoticRootDialog)
- METHOD(XonoticHUDPowerupsDialog, fill, void(entity));
- ATTRIB(XonoticHUDPowerupsDialog, title, string, _("Powerups Panel"))
- ATTRIB(XonoticHUDPowerupsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDPowerupsDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDPowerupsDialog, rows, float, 14)
- ATTRIB(XonoticHUDPowerupsDialog, columns, float, 4)
- ATTRIB(XonoticHUDPowerupsDialog, name, string, "HUDpowerups")
- ATTRIB(XonoticHUDPowerupsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDPowerupsDialog)
-#endif
+#include "dialog_hudpanel_powerups.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDPowerupsDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "2", _("Inward")));
me.TD(me, 1, 0.95, e = makeXonoticRadioButton(3, "hud_panel_powerups_iconalign", "3", _("Outward")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPowerupsDialog, XonoticRootDialog)
+ METHOD(XonoticHUDPowerupsDialog, fill, void(entity));
+ ATTRIB(XonoticHUDPowerupsDialog, title, string, _("Powerups Panel"))
+ ATTRIB(XonoticHUDPowerupsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDPowerupsDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDPowerupsDialog, rows, float, 14)
+ ATTRIB(XonoticHUDPowerupsDialog, columns, float, 4)
+ ATTRIB(XonoticHUDPowerupsDialog, name, string, "HUDpowerups")
+ ATTRIB(XonoticHUDPowerupsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPowerupsDialog)
-#ifndef DIALOG_HUDPANEL_PRESSEDKEYS_H
-#define DIALOG_HUDPANEL_PRESSEDKEYS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDPressedKeysDialog, XonoticRootDialog)
- METHOD(XonoticHUDPressedKeysDialog, fill, void(entity));
- ATTRIB(XonoticHUDPressedKeysDialog, title, string, _("Pressed Keys Panel"))
- ATTRIB(XonoticHUDPressedKeysDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDPressedKeysDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDPressedKeysDialog, rows, float, 15)
- ATTRIB(XonoticHUDPressedKeysDialog, columns, float, 4)
- ATTRIB(XonoticHUDPressedKeysDialog, name, string, "HUDpressedkeys")
- ATTRIB(XonoticHUDPressedKeysDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDPressedKeysDialog)
-#endif
+#include "dialog_hudpanel_pressedkeys.qh"
+
+#include "textslider.qh"
+#include "slider.qh"
+#include "textlabel.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDPressedKeysDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Forced aspect:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(0.2, 4, 0.1, "hud_panel_pressedkeys_aspect"));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDPressedKeysDialog, XonoticRootDialog)
+ METHOD(XonoticHUDPressedKeysDialog, fill, void(entity));
+ ATTRIB(XonoticHUDPressedKeysDialog, title, string, _("Pressed Keys Panel"))
+ ATTRIB(XonoticHUDPressedKeysDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDPressedKeysDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDPressedKeysDialog, rows, float, 15)
+ ATTRIB(XonoticHUDPressedKeysDialog, columns, float, 4)
+ ATTRIB(XonoticHUDPressedKeysDialog, name, string, "HUDpressedkeys")
+ ATTRIB(XonoticHUDPressedKeysDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDPressedKeysDialog)
-#ifndef DIALOG_HUDPANEL_QUICKMENU_H
-#define DIALOG_HUDPANEL_QUICKMENU_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDQuickMenuDialog, XonoticRootDialog)
- METHOD(XonoticHUDQuickMenuDialog, fill, void(entity));
- ATTRIB(XonoticHUDQuickMenuDialog, title, string, _("Quick Menu Panel"))
- ATTRIB(XonoticHUDQuickMenuDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDQuickMenuDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDQuickMenuDialog, rows, float, 15)
- ATTRIB(XonoticHUDQuickMenuDialog, columns, float, 4)
- ATTRIB(XonoticHUDQuickMenuDialog, name, string, "HUDquickmenu")
-ENDCLASS(XonoticHUDQuickMenuDialog)
-#endif
+#include "dialog_hudpanel_quickmenu.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDQuickMenuDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "0.5", _("Center")));
me.TD(me, 1, 3.8/3, e = makeXonoticRadioButton(3, "hud_panel_quickmenu_align", "1", _("Right")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDQuickMenuDialog, XonoticRootDialog)
+ METHOD(XonoticHUDQuickMenuDialog, fill, void(entity));
+ ATTRIB(XonoticHUDQuickMenuDialog, title, string, _("Quick Menu Panel"))
+ ATTRIB(XonoticHUDQuickMenuDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDQuickMenuDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDQuickMenuDialog, rows, float, 15)
+ ATTRIB(XonoticHUDQuickMenuDialog, columns, float, 4)
+ ATTRIB(XonoticHUDQuickMenuDialog, name, string, "HUDquickmenu")
+ENDCLASS(XonoticHUDQuickMenuDialog)
-#ifndef DIALOG_HUDPANEL_RACETIMER_H
-#define DIALOG_HUDPANEL_RACETIMER_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDRaceTimerDialog, XonoticRootDialog)
- METHOD(XonoticHUDRaceTimerDialog, fill, void(entity));
- ATTRIB(XonoticHUDRaceTimerDialog, title, string, _("Race Timer Panel"))
- ATTRIB(XonoticHUDRaceTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDRaceTimerDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDRaceTimerDialog, rows, float, 15)
- ATTRIB(XonoticHUDRaceTimerDialog, columns, float, 4)
- ATTRIB(XonoticHUDRaceTimerDialog, name, string, "HUDracetimer")
- ATTRIB(XonoticHUDRaceTimerDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDRaceTimerDialog)
-#endif
+#include "dialog_hudpanel_racetimer.qh"
+
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDRaceTimerDialog_fill(entity me)
{
entity e;
DIALOG_HUDPANEL_COMMON();
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDRaceTimerDialog, XonoticRootDialog)
+ METHOD(XonoticHUDRaceTimerDialog, fill, void(entity));
+ ATTRIB(XonoticHUDRaceTimerDialog, title, string, _("Race Timer Panel"))
+ ATTRIB(XonoticHUDRaceTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDRaceTimerDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDRaceTimerDialog, rows, float, 15)
+ ATTRIB(XonoticHUDRaceTimerDialog, columns, float, 4)
+ ATTRIB(XonoticHUDRaceTimerDialog, name, string, "HUDracetimer")
+ ATTRIB(XonoticHUDRaceTimerDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDRaceTimerDialog)
-#ifndef DIALOG_HUDPANEL_RADAR_H
-#define DIALOG_HUDPANEL_RADAR_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDRadarDialog, XonoticRootDialog)
- METHOD(XonoticHUDRadarDialog, fill, void(entity));
- ATTRIB(XonoticHUDRadarDialog, title, string, _("Radar Panel"))
- ATTRIB(XonoticHUDRadarDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDRadarDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDRadarDialog, rows, float, 15)
- ATTRIB(XonoticHUDRadarDialog, columns, float, 4)
- ATTRIB(XonoticHUDRadarDialog, name, string, "HUDradar")
- ATTRIB(XonoticHUDRadarDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDRadarDialog)
-#endif
+#include "dialog_hudpanel_radar.qh"
+
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "textlabel.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDRadarDialog_fill(entity me)
{
entity e;
e.addValue(e, _("Never zoomed"), "3");
e.configureXonoticTextSliderValues(e);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDRadarDialog, XonoticRootDialog)
+ METHOD(XonoticHUDRadarDialog, fill, void(entity));
+ ATTRIB(XonoticHUDRadarDialog, title, string, _("Radar Panel"))
+ ATTRIB(XonoticHUDRadarDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDRadarDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDRadarDialog, rows, float, 15)
+ ATTRIB(XonoticHUDRadarDialog, columns, float, 4)
+ ATTRIB(XonoticHUDRadarDialog, name, string, "HUDradar")
+ ATTRIB(XonoticHUDRadarDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDRadarDialog)
-#ifndef DIALOG_HUDPANEL_SCORE_H
-#define DIALOG_HUDPANEL_SCORE_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDScoreDialog, XonoticRootDialog)
- METHOD(XonoticHUDScoreDialog, fill, void(entity));
- ATTRIB(XonoticHUDScoreDialog, title, string, _("Score Panel"))
- ATTRIB(XonoticHUDScoreDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDScoreDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDScoreDialog, rows, float, 15)
- ATTRIB(XonoticHUDScoreDialog, columns, float, 4)
- ATTRIB(XonoticHUDScoreDialog, name, string, "HUDscore")
- ATTRIB(XonoticHUDScoreDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDScoreDialog)
-#endif
+#include "dialog_hudpanel_score.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDScoreDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "1", _("And me")));
me.TD(me, 1, 2.6/3, e = makeXonoticRadioButton(1, "hud_panel_score_rankings", "2", _("Pure")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDScoreDialog, XonoticRootDialog)
+ METHOD(XonoticHUDScoreDialog, fill, void(entity));
+ ATTRIB(XonoticHUDScoreDialog, title, string, _("Score Panel"))
+ ATTRIB(XonoticHUDScoreDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDScoreDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDScoreDialog, rows, float, 15)
+ ATTRIB(XonoticHUDScoreDialog, columns, float, 4)
+ ATTRIB(XonoticHUDScoreDialog, name, string, "HUDscore")
+ ATTRIB(XonoticHUDScoreDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDScoreDialog)
-#ifndef DIALOG_HUDPANEL_TIMER_H
-#define DIALOG_HUDPANEL_TIMER_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDTimerDialog, XonoticRootDialog)
- METHOD(XonoticHUDTimerDialog, fill, void(entity));
- ATTRIB(XonoticHUDTimerDialog, title, string, _("Timer Panel"))
- ATTRIB(XonoticHUDTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDTimerDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDTimerDialog, rows, float, 15)
- ATTRIB(XonoticHUDTimerDialog, columns, float, 4)
- ATTRIB(XonoticHUDTimerDialog, name, string, "HUDtimer")
- ATTRIB(XonoticHUDTimerDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDTimerDialog)
-#endif
+#include "dialog_hudpanel_timer.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDTimerDialog_fill(entity me)
{
entity e;
me.TDempty(me, 0.2);
me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_timer_increment", _("Show elapsed time")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDTimerDialog, XonoticRootDialog)
+ METHOD(XonoticHUDTimerDialog, fill, void(entity));
+ ATTRIB(XonoticHUDTimerDialog, title, string, _("Timer Panel"))
+ ATTRIB(XonoticHUDTimerDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDTimerDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDTimerDialog, rows, float, 15)
+ ATTRIB(XonoticHUDTimerDialog, columns, float, 4)
+ ATTRIB(XonoticHUDTimerDialog, name, string, "HUDtimer")
+ ATTRIB(XonoticHUDTimerDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDTimerDialog)
-#ifndef DIALOG_HUDPANEL_VOTE_H
-#define DIALOG_HUDPANEL_VOTE_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDVoteDialog, XonoticRootDialog)
- METHOD(XonoticHUDVoteDialog, fill, void(entity));
- ATTRIB(XonoticHUDVoteDialog, title, string, _("Vote Panel"))
- ATTRIB(XonoticHUDVoteDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDVoteDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDVoteDialog, rows, float, 15)
- ATTRIB(XonoticHUDVoteDialog, columns, float, 4)
- ATTRIB(XonoticHUDVoteDialog, name, string, "HUDvote")
- ATTRIB(XonoticHUDVoteDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDVoteDialog)
-#endif
+#include "dialog_hudpanel_vote.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDVoteDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Alpha after voting:")));
me.TD(me, 1, 2.6, e = makeXonoticSlider(0.1, 1, 0.1, "hud_panel_vote_alreadyvoted_alpha"));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDVoteDialog, XonoticRootDialog)
+ METHOD(XonoticHUDVoteDialog, fill, void(entity));
+ ATTRIB(XonoticHUDVoteDialog, title, string, _("Vote Panel"))
+ ATTRIB(XonoticHUDVoteDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDVoteDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDVoteDialog, rows, float, 15)
+ ATTRIB(XonoticHUDVoteDialog, columns, float, 4)
+ ATTRIB(XonoticHUDVoteDialog, name, string, "HUDvote")
+ ATTRIB(XonoticHUDVoteDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDVoteDialog)
-#ifndef DIALOG_HUDPANEL_WEAPONS_H
-#define DIALOG_HUDPANEL_WEAPONS_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDWeaponsDialog, XonoticRootDialog)
- METHOD(XonoticHUDWeaponsDialog, fill, void(entity));
- ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
- ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticHUDWeaponsDialog, rows, float, 21)
- ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
- ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
- ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDWeaponsDialog)
-#endif
+#include "dialog_hudpanel_weapons.qh"
+
+#include "checkbox.qh"
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
+#include "colorpicker_string.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDWeaponsDialog_fill(entity me)
{
entity e;
setDependent(e, "hud_panel_weapons_ammo", 1, 1);
me.TR(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDWeaponsDialog, XonoticRootDialog)
+ METHOD(XonoticHUDWeaponsDialog, fill, void(entity));
+ ATTRIB(XonoticHUDWeaponsDialog, title, string, _("Weapons Panel"))
+ ATTRIB(XonoticHUDWeaponsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDWeaponsDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDWeaponsDialog, rows, float, 21)
+ ATTRIB(XonoticHUDWeaponsDialog, columns, float, 4)
+ ATTRIB(XonoticHUDWeaponsDialog, name, string, "HUDweapons")
+ ATTRIB(XonoticHUDWeaponsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDWeaponsDialog)
-#ifndef DIALOG_HUDSETUP_EXIT_H
-#define DIALOG_HUDSETUP_EXIT_H
-#include "rootdialog.qc"
-CLASS(XonoticHUDExitDialog, XonoticRootDialog)
- METHOD(XonoticHUDExitDialog, fill, void(entity));
- ATTRIB(XonoticHUDExitDialog, title, string, _("Panel HUD Setup"))
- ATTRIB(XonoticHUDExitDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticHUDExitDialog, intendedWidth, float, 0.8)
- ATTRIB(XonoticHUDExitDialog, rows, float, 18)
- ATTRIB(XonoticHUDExitDialog, columns, float, 8.2)
- ATTRIB(XonoticHUDExitDialog, name, string, "HUDExit")
- ATTRIB(XonoticHUDExitDialog, requiresConnection, float, true)
-ENDCLASS(XonoticHUDExitDialog)
+#include "dialog_hudsetup_exit.qh"
-#endif
+#include "textlabel.qh"
+#include "button.qh"
+#include "textslider.qh"
+#include "inputbox.qh"
+#include "hudskinlist.qh"
+#include "colorpicker_string.qh"
+#include "checkbox.qh"
+#include "commandbutton.qh"
-#ifdef IMPLEMENTATION
void XonoticHUDExitDialog_fill(entity me)
{
entity e;
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Exit setup"), '0 0 0', "_hud_configure 0", 1));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDExitDialog, XonoticRootDialog)
+ METHOD(XonoticHUDExitDialog, fill, void(entity));
+ ATTRIB(XonoticHUDExitDialog, title, string, _("Panel HUD Setup"))
+ ATTRIB(XonoticHUDExitDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDExitDialog, intendedWidth, float, 0.8)
+ ATTRIB(XonoticHUDExitDialog, rows, float, 18)
+ ATTRIB(XonoticHUDExitDialog, columns, float, 8.2)
+ ATTRIB(XonoticHUDExitDialog, name, string, "HUDExit")
+ ATTRIB(XonoticHUDExitDialog, requiresConnection, float, true)
+ENDCLASS(XonoticHUDExitDialog)
-#ifndef DIALOG_MONSTERTOOLS_H
-#define DIALOG_MONSTERTOOLS_H
-#include "rootdialog.qc"
-CLASS(XonoticMonsterToolsDialog, XonoticRootDialog)
- METHOD(XonoticMonsterToolsDialog, fill, void(entity));
- ATTRIB(XonoticMonsterToolsDialog, title, string, _("Monster Tools"))
- ATTRIB(XonoticMonsterToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
- ATTRIB(XonoticMonsterToolsDialog, intendedWidth, float, 0.8)
- ATTRIB(XonoticMonsterToolsDialog, rows, float, 16)
- ATTRIB(XonoticMonsterToolsDialog, columns, float, 4)
- ATTRIB(XonoticMonsterToolsDialog, name, string, "MonsterTools")
-ENDCLASS(XonoticMonsterToolsDialog)
-#endif
+#include "dialog_monstertools.qh"
+
+#include "textlabel.qh"
+#include "radiobutton.qh"
+#include "commandbutton.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticMonsterToolsDialog_fill(entity me)
{
entity e;
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticMonsterToolsDialog, XonoticRootDialog)
+ METHOD(XonoticMonsterToolsDialog, fill, void(entity));
+ ATTRIB(XonoticMonsterToolsDialog, title, string, _("Monster Tools"))
+ ATTRIB(XonoticMonsterToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
+ ATTRIB(XonoticMonsterToolsDialog, intendedWidth, float, 0.8)
+ ATTRIB(XonoticMonsterToolsDialog, rows, float, 16)
+ ATTRIB(XonoticMonsterToolsDialog, columns, float, 4)
+ ATTRIB(XonoticMonsterToolsDialog, name, string, "MonsterTools")
+ENDCLASS(XonoticMonsterToolsDialog)
-#ifndef DIALOG_MULTIPLAYER_H
-#define DIALOG_MULTIPLAYER_H
-#include "dialog.qc"
-CLASS(XonoticMultiplayerDialog, XonoticDialog)
- METHOD(XonoticMultiplayerDialog, fill, void(entity));
- ATTRIB(XonoticMultiplayerDialog, title, string, _("Multiplayer"))
- ATTRIB(XonoticMultiplayerDialog, tooltip, string, _("Play online, against your friends in LAN, view demos or change player settings"))
- ATTRIB(XonoticMultiplayerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
- ATTRIB(XonoticMultiplayerDialog, intendedWidth, float, 0.96)
- ATTRIB(XonoticMultiplayerDialog, rows, float, 24)
- ATTRIB(XonoticMultiplayerDialog, columns, float, 4)
-ENDCLASS(XonoticMultiplayerDialog)
-#endif
+#include "dialog_multiplayer.qh"
+
+#include "tabcontroller.qh"
+#include "dialog_multiplayer_join.qh"
+#include "dialog_multiplayer_create.qh"
+#include "dialog_multiplayer_media.qh"
+#include "dialog_multiplayer_profile.qh"
-#ifdef IMPLEMENTATION
void XonoticMultiplayerDialog_fill(entity me)
{
entity mc, e;
me.TR(me);
me.TD(me, me.rows - 1, me.columns, mc);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticMultiplayerDialog, XonoticDialog)
+ METHOD(XonoticMultiplayerDialog, fill, void(entity));
+ ATTRIB(XonoticMultiplayerDialog, title, string, _("Multiplayer"))
+ ATTRIB(XonoticMultiplayerDialog, tooltip, string, _("Play online, against your friends in LAN, view demos or change player settings"))
+ ATTRIB(XonoticMultiplayerDialog, color, vector, SKINCOLOR_DIALOG_MULTIPLAYER)
+ ATTRIB(XonoticMultiplayerDialog, intendedWidth, float, 0.96)
+ ATTRIB(XonoticMultiplayerDialog, rows, float, 24)
+ ATTRIB(XonoticMultiplayerDialog, columns, float, 4)
+ENDCLASS(XonoticMultiplayerDialog)
-#ifndef DIALOG_MULTIPLAYER_CREATE_H
-#define DIALOG_MULTIPLAYER_CREATE_H
-#include "tab.qc"
-CLASS(XonoticServerCreateTab, XonoticTab)
- METHOD(XonoticServerCreateTab, fill, void(entity));
- METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity));
- METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity));
- ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticServerCreateTab, rows, float, 23)
- ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
-
- ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
- ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
- ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
- ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
- ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
- ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
-ENDCLASS(XonoticServerCreateTab)
-entity makeXonoticServerCreateTab();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "dialog_multiplayer_create.qh"
+
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "dialog_multiplayer_create_mutators.qh"
+
+#include "gametypelist.qh"
+#include "maplist.qh"
+#include <common/mapinfo.qh>
+
+#include "image.qh"
+#include "textslider.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "mainwindow.qh"
+#include "button.qh"
+#include "inputbox.qh"
void GameType_ConfigureSliders(entity me, string pLabel, float pMin, float pMax, float pStep, string pCvar, string tCvar, string pTooltip)
{
{
me.setFocus(me, me.mapListBox);
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticServerCreateTab, XonoticTab)
+ METHOD(XonoticServerCreateTab, fill, void(entity));
+ METHOD(XonoticServerCreateTab, gameTypeChangeNotify, void(entity));
+ METHOD(XonoticServerCreateTab, gameTypeSelectNotify, void(entity));
+ ATTRIB(XonoticServerCreateTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticServerCreateTab, rows, float, 23)
+ ATTRIB(XonoticServerCreateTab, columns, float, 6.2) // added extra .2 for center space
+
+ ATTRIB(XonoticServerCreateTab, mapListBox, entity, NULL)
+ ATTRIB(XonoticServerCreateTab, sliderFraglimit, entity, NULL)
+ ATTRIB(XonoticServerCreateTab, sliderTeams, entity, NULL)
+ ATTRIB(XonoticServerCreateTab, sliderTimelimit, entity, NULL)
+ ATTRIB(XonoticServerCreateTab, labelFraglimit, entity, NULL)
+ ATTRIB(XonoticServerCreateTab, labelTeams, entity, NULL)
+ENDCLASS(XonoticServerCreateTab)
+entity makeXonoticServerCreateTab();
-#ifndef DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
-#define DIALOG_MULTIPLAYER_CREATE_MAPINFO_H
-#include "dialog.qc"
-CLASS(XonoticMapInfoDialog, XonoticDialog)
- METHOD(XonoticMapInfoDialog, fill, void(entity));
- METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity));
- ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
- ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
- ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
- ATTRIB(XonoticMapInfoDialog, rows, float, 11)
- ATTRIB(XonoticMapInfoDialog, columns, float, 10)
+#include "dialog_multiplayer_create_mapinfo.qh"
- ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
- ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
- ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
- ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
- ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
+#include "button.qh"
+#include "image.qh"
+#include "maplist.qh"
+#include "textlabel.qh"
+#include <common/mapinfo.qh>
- ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
-
- ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
- ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
- ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
- ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
- ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
- ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
-ENDCLASS(XonoticMapInfoDialog)
-#endif
-
-#ifdef IMPLEMENTATION
void XonoticMapInfoDialog_loadMapInfo(entity me, int i, entity mlb)
{
me.currentMapIndex = i;
me.startButton.onClick = MapList_LoadMap;
me.startButton.onClickEntity = NULL; // filled later
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticMapInfoDialog, XonoticDialog)
+ METHOD(XonoticMapInfoDialog, fill, void(entity));
+ METHOD(XonoticMapInfoDialog, loadMapInfo, void(entity, float, entity));
+ ATTRIB(XonoticMapInfoDialog, title, string, _("Map Information"))
+ ATTRIB(XonoticMapInfoDialog, color, vector, SKINCOLOR_DIALOG_MAPINFO)
+ ATTRIB(XonoticMapInfoDialog, intendedWidth, float, 1.0)
+ ATTRIB(XonoticMapInfoDialog, rows, float, 11)
+ ATTRIB(XonoticMapInfoDialog, columns, float, 10)
+
+ ATTRIB(XonoticMapInfoDialog, previewImage, entity, NULL)
+ ATTRIB(XonoticMapInfoDialog, titleLabel, entity, NULL)
+ ATTRIB(XonoticMapInfoDialog, authorLabel, entity, NULL)
+ ATTRIB(XonoticMapInfoDialog, descriptionLabel, entity, NULL)
+ ATTRIB(XonoticMapInfoDialog, featuresLabel, entity, NULL)
+
+ ATTRIBARRAY(XonoticMapInfoDialog, typeLabels, entity, 24)
+
+ ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
+ ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
+ ATTRIB(XonoticMapInfoDialog, currentMapTitle, string, string_null)
+ ATTRIB(XonoticMapInfoDialog, currentMapAuthor, string, string_null)
+ ATTRIB(XonoticMapInfoDialog, currentMapDescription, string, string_null)
+ ATTRIB(XonoticMapInfoDialog, currentMapPreviewImage, string, string_null)
+ENDCLASS(XonoticMapInfoDialog)
+#include "dialog_multiplayer_create_mutators.qh"
#include <common/weapons/all.qh>
-#ifndef DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
-#define DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
-#include "dialog.qc"
-CLASS(XonoticMutatorsDialog, XonoticDialog)
- METHOD(XonoticMutatorsDialog, toString, string(entity));
- METHOD(XonoticMutatorsDialog, fill, void(entity));
- METHOD(XonoticMutatorsDialog, showNotify, void(entity));
- METHOD(XonoticMutatorsDialog, close, void(entity));
- ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
- ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
- ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
- ATTRIB(XonoticMutatorsDialog, rows, float, 20)
- ATTRIB(XonoticMutatorsDialog, columns, float, 6)
- ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
-ENDCLASS(XonoticMutatorsDialog)
-#endif
+#include "weaponarenacheckbox.qh"
+#include "checkbox.qh"
+#include "slider.qh"
+#include "textlabel.qh"
+#include "checkbox_slider_invalid.qh"
+#include "radiobutton.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticMutatorsDialog_showNotify(entity me)
{
SUPER(XonoticMutatorsDialog).showNotify(me);
e.onClickEntity = me;
}
+.void(entity) refilter;
+
void XonoticMutatorsDialog_close(entity me)
{
if(me.refilterEntity)
me.refilterEntity.refilter(me.refilterEntity);
SUPER(XonoticMutatorsDialog).close(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticMutatorsDialog, XonoticDialog)
+ METHOD(XonoticMutatorsDialog, toString, string(entity));
+ METHOD(XonoticMutatorsDialog, fill, void(entity));
+ METHOD(XonoticMutatorsDialog, showNotify, void(entity));
+ METHOD(XonoticMutatorsDialog, close, void(entity));
+ ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
+ ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
+ ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
+ ATTRIB(XonoticMutatorsDialog, rows, float, 20)
+ ATTRIB(XonoticMutatorsDialog, columns, float, 6)
+ ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
+ENDCLASS(XonoticMutatorsDialog)
-#ifndef DIALOG_MULTIPLAYER_JOIN_H
-#define DIALOG_MULTIPLAYER_JOIN_H
-#include "tab.qc"
-CLASS(XonoticServerListTab, XonoticTab)
- METHOD(XonoticServerListTab, fill, void(entity));
- ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticServerListTab, rows, float, 23)
- ATTRIB(XonoticServerListTab, columns, float, 6.5)
-ENDCLASS(XonoticServerListTab)
-entity makeXonoticServerListTab();
-#endif
+#include "dialog_multiplayer_join.qh"
-#ifdef IMPLEMENTATION
+#include "serverlist.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "checkbox.qh"
+#include "button.qh"
entity makeXonoticServerListTab()
{
e.onClickEntity = slist;
slist.connectButton = e;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticServerListTab, XonoticTab)
+ METHOD(XonoticServerListTab, fill, void(entity));
+ ATTRIB(XonoticServerListTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticServerListTab, rows, float, 23)
+ ATTRIB(XonoticServerListTab, columns, float, 6.5)
+ENDCLASS(XonoticServerListTab)
+entity makeXonoticServerListTab();
+#include "dialog_multiplayer_join_serverinfo.qh"
#include <common/mapinfo.qh>
-#ifndef DIALOG_MULTIPLAYER_JOIN_SERVERINFO_H
-#define DIALOG_MULTIPLAYER_JOIN_SERVERINFO_H
-#include "dialog.qc"
-CLASS(XonoticServerInfoDialog, XonoticDialog)
- METHOD(XonoticServerInfoDialog, fill, void(entity));
- METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float));
- ATTRIB(XonoticServerInfoDialog, title, string, _("Server Information"))
- ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
- ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.8)
- ATTRIB(XonoticServerInfoDialog, rows, float, 18)
- ATTRIB(XonoticServerInfoDialog, columns, float, 6.2)
-
- ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerNumFreeSlots, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
- ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
-
- ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, numFreeSlotsLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, keyLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, idLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, encryptLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity, NULL)
- ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
-ENDCLASS(XonoticServerInfoDialog)
-
-void Join_Click(entity btn, entity me);
-#endif
+#include "serverlist.qh"
+#include "playerlist.qh"
+#include "inputbox.qh"
+#include "textlabel.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
{
bool pure_available;
{
localcmd("connect ", me.currentServerCName, "\n");
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticServerInfoDialog, XonoticDialog)
+ METHOD(XonoticServerInfoDialog, fill, void(entity));
+ METHOD(XonoticServerInfoDialog, loadServerInfo, void(entity, float));
+ ATTRIB(XonoticServerInfoDialog, title, string, _("Server Information"))
+ ATTRIB(XonoticServerInfoDialog, color, vector, SKINCOLOR_DIALOG_SERVERINFO)
+ ATTRIB(XonoticServerInfoDialog, intendedWidth, float, 0.8)
+ ATTRIB(XonoticServerInfoDialog, rows, float, 18)
+ ATTRIB(XonoticServerInfoDialog, columns, float, 6.2)
+
+ ATTRIB(XonoticServerInfoDialog, currentServerName, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerCName, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerType, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerMap, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerPlayers, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerNumPlayers, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerNumBots, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerNumFreeSlots, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerMod, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerVersion, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
+ ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
+
+ ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, cnameLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, typeLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, mapLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, rawPlayerList, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, numPlayersLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, numBotsLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, numFreeSlotsLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, modLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, versionLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, keyLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, idLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, encryptLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, canConnectLabel, entity, NULL)
+ ATTRIB(XonoticServerInfoDialog, pureLabel, entity, NULL)
+ENDCLASS(XonoticServerInfoDialog)
+
+void Join_Click(entity btn, entity me);
-#ifndef DIALOG_MULTIPLAYER_MEDIA_H
-#define DIALOG_MULTIPLAYER_MEDIA_H
-#include "tab.qc"
-CLASS(XonoticMediaTab, XonoticTab)
- METHOD(XonoticMediaTab, fill, void(entity));
- ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticMediaTab, rows, float, 23)
- ATTRIB(XonoticMediaTab, columns, float, 3)
- ATTRIB(XonoticMediaTab, name, string, "Media")
-ENDCLASS(XonoticMediaTab)
-entity makeXonoticMediaTab();
-#endif
+#include "dialog_multiplayer_media.qh"
+
+#include "demolist.qh"
+#include "dialog_multiplayer_media_demo.qh"
+#include "dialog_multiplayer_media_screenshot.qh"
+#include "dialog_multiplayer_media_musicplayer.qh"
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+
+#include "tabcontroller.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticMediaTab()
{
entity me;
me.gotoRC(me, 3, 0);
me.TD(me, me.rows - 2, me.columns, mc);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticMediaTab, XonoticTab)
+ METHOD(XonoticMediaTab, fill, void(entity));
+ ATTRIB(XonoticMediaTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticMediaTab, rows, float, 23)
+ ATTRIB(XonoticMediaTab, columns, float, 3)
+ ATTRIB(XonoticMediaTab, name, string, "Media")
+ENDCLASS(XonoticMediaTab)
+entity makeXonoticMediaTab();
-#ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_H
-#define DIALOG_MULTIPLAYER_MEDIA_DEMO_H
-#include "tab.qc"
-CLASS(XonoticDemoBrowserTab, XonoticTab)
- METHOD(XonoticDemoBrowserTab, fill, void(entity));
- ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
- ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
- ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
- ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
-ENDCLASS(XonoticDemoBrowserTab)
-entity makeXonoticDemoBrowserTab();
-#endif
+#include "dialog_multiplayer_media_demo.qh"
+
+#include "demolist.qh"
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "checkbox.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
const float DMO_PLAY = 1;
const float DMO_TIME = 2;
void DemoConfirm_Check_Gamestatus(entity btn, entity me)
e.onClick = DemoConfirm_Check_Gamestatus;
e.onClickEntity = me; // demolist is global anyway
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticDemoBrowserTab, XonoticTab)
+ METHOD(XonoticDemoBrowserTab, fill, void(entity));
+ ATTRIB(XonoticDemoBrowserTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticDemoBrowserTab, rows, float, 21)
+ ATTRIB(XonoticDemoBrowserTab, columns, float, 6.5)
+ ATTRIB(XonoticDemoBrowserTab, name, string, "DemoBrowser")
+ ATTRIB(XonoticDemoBrowserTab, democlicktype, float, 0)
+ENDCLASS(XonoticDemoBrowserTab)
+entity makeXonoticDemoBrowserTab();
-#ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_STARTCONFIRM_H
-#define DIALOG_MULTIPLAYER_MEDIA_DEMO_STARTCONFIRM_H
-#include "dialog.qc"
-CLASS(XonoticDemoStartConfirmDialog, XonoticDialog)
- METHOD(XonoticDemoStartConfirmDialog, fill, void(entity));
- ATTRIB(XonoticDemoStartConfirmDialog, title, string, _("Disconnect"))
- ATTRIB(XonoticDemoStartConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
- ATTRIB(XonoticDemoStartConfirmDialog, intendedWidth, float, 0.5)
- ATTRIB(XonoticDemoStartConfirmDialog, rows, float, 4)
- ATTRIB(XonoticDemoStartConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticDemoStartConfirmDialog)
-#endif
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+
+#include "demolist.qh"
+#include "textlabel.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void Handle_StartDemo_Click(entity unused, entity me) { demolist.startDemo(demolist); }
void XonoticDemoStartConfirmDialog_fill(entity me)
{
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticDemoStartConfirmDialog, XonoticDialog)
+ METHOD(XonoticDemoStartConfirmDialog, fill, void(entity));
+ ATTRIB(XonoticDemoStartConfirmDialog, title, string, _("Disconnect"))
+ ATTRIB(XonoticDemoStartConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+ ATTRIB(XonoticDemoStartConfirmDialog, intendedWidth, float, 0.5)
+ ATTRIB(XonoticDemoStartConfirmDialog, rows, float, 4)
+ ATTRIB(XonoticDemoStartConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticDemoStartConfirmDialog)
-#ifndef DIALOG_MULTIPLAYER_MEDIA_DEMO_TIMECONFIRM_H
-#define DIALOG_MULTIPLAYER_MEDIA_DEMO_TIMECONFIRM_H
-#include "dialog.qc"
-CLASS(XonoticDemoTimeConfirmDialog, XonoticDialog)
- METHOD(XonoticDemoTimeConfirmDialog, fill, void(entity));
- ATTRIB(XonoticDemoTimeConfirmDialog, title, string, _("Disconnect"))
- ATTRIB(XonoticDemoTimeConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
- ATTRIB(XonoticDemoTimeConfirmDialog, intendedWidth, float, 0.5)
- ATTRIB(XonoticDemoTimeConfirmDialog, rows, float, 4)
- ATTRIB(XonoticDemoTimeConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticDemoTimeConfirmDialog)
-#endif
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+
+#include "demolist.qh"
+#include "textlabel.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void Handle_TimeDemo_Click(entity unused, entity unused) { demolist.timeDemo(demolist); }
void XonoticDemoTimeConfirmDialog_fill(entity me)
{
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticDemoTimeConfirmDialog, XonoticDialog)
+ METHOD(XonoticDemoTimeConfirmDialog, fill, void(entity));
+ ATTRIB(XonoticDemoTimeConfirmDialog, title, string, _("Disconnect"))
+ ATTRIB(XonoticDemoTimeConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+ ATTRIB(XonoticDemoTimeConfirmDialog, intendedWidth, float, 0.5)
+ ATTRIB(XonoticDemoTimeConfirmDialog, rows, float, 4)
+ ATTRIB(XonoticDemoTimeConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticDemoTimeConfirmDialog)
-#ifndef DIALOG_MULTIPLAYER_MEDIA_MUSICPLAYER_H
-#define DIALOG_MULTIPLAYER_MEDIA_MUSICPLAYER_H
-#include "tab.qc"
-CLASS(XonoticMusicPlayerTab, XonoticTab)
- METHOD(XonoticMusicPlayerTab, fill, void(entity));
- ATTRIB(XonoticMusicPlayerTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticMusicPlayerTab, rows, float, 21)
- ATTRIB(XonoticMusicPlayerTab, columns, float, 6.5)
- ATTRIB(XonoticMusicPlayerTab, name, string, "MusicPlayer")
-ENDCLASS(XonoticMusicPlayerTab)
-entity makeXonoticMusicPlayerTab();
-#endif
+#include "dialog_multiplayer_media_musicplayer.qh"
+
+#include "soundlist.qh"
+#include "playlist.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "button.qh"
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticMusicPlayerTab()
{
entity me;
e.onClick = PlayList_Remove_All;
e.onClickEntity = playList;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticMusicPlayerTab, XonoticTab)
+ METHOD(XonoticMusicPlayerTab, fill, void(entity));
+ ATTRIB(XonoticMusicPlayerTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticMusicPlayerTab, rows, float, 21)
+ ATTRIB(XonoticMusicPlayerTab, columns, float, 6.5)
+ ATTRIB(XonoticMusicPlayerTab, name, string, "MusicPlayer")
+ENDCLASS(XonoticMusicPlayerTab)
+entity makeXonoticMusicPlayerTab();
-#ifndef DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_H
-#define DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_H
-#include "tab.qc"
-CLASS(XonoticScreenshotBrowserTab, XonoticTab)
- METHOD(XonoticScreenshotBrowserTab, fill, void(entity));
- ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
- ATTRIB(XonoticScreenshotBrowserTab, rows, float, 21)
- ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
- ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+#include "dialog_multiplayer_media_screenshot.qh"
- METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string));
- ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
- ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotBrowserTab)
-entity makeXonoticScreenshotBrowserTab();
-#endif
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "screenshotlist.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "checkbox.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticScreenshotBrowserTab()
{
entity me;
slist.screenshotBrowserDialog = me;
*/
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticScreenshotBrowserTab, XonoticTab)
+ METHOD(XonoticScreenshotBrowserTab, fill, void(entity));
+ ATTRIB(XonoticScreenshotBrowserTab, intendedWidth, float, 1)
+ ATTRIB(XonoticScreenshotBrowserTab, rows, float, 21)
+ ATTRIB(XonoticScreenshotBrowserTab, columns, float, 6.5)
+ ATTRIB(XonoticScreenshotBrowserTab, name, string, "ScreenshotBrowser")
+
+ METHOD(XonoticScreenshotBrowserTab, loadPreviewScreenshot, void(entity, string));
+ ATTRIB(XonoticScreenshotBrowserTab, screenshotImage, entity, NULL)
+ ATTRIB(XonoticScreenshotBrowserTab, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotBrowserTab)
+entity makeXonoticScreenshotBrowserTab();
-#ifndef DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_VIEWER_H
-#define DIALOG_MULTIPLAYER_MEDIA_SCREENSHOT_VIEWER_H
-#include "dialog.qc"
-CLASS(XonoticScreenshotViewerDialog, XonoticDialog)
- METHOD(XonoticScreenshotViewerDialog, fill, void(entity));
- METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float));
- METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string));
- METHOD(XonoticScreenshotViewerDialog, close, void(entity));
- ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
- ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
- ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
- ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
- ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
- ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
- ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
- ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
- ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
- ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
-ENDCLASS(XonoticScreenshotViewerDialog)
-#endif
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+
+#include "screenshotlist.qh"
+#include "inputbox.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
float music_playlist_index_backup;
void XonoticScreenshotViewerDialog_loadScreenshot(entity me, string scrImage)
{
e.onClickEntity = me;
me.slideShowButton = e;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+
+#include "screenshotimage.qh"
+
+CLASS(XonoticScreenshotViewerDialog, XonoticDialog)
+ METHOD(XonoticScreenshotViewerDialog, fill, void(entity));
+ METHOD(XonoticScreenshotViewerDialog, keyDown, float(entity, float, float, float));
+ METHOD(XonoticScreenshotViewerDialog, loadScreenshot, void(entity, string));
+ METHOD(XonoticScreenshotViewerDialog, close, void(entity));
+ ATTRIB(XonoticScreenshotViewerDialog, title, string, "Screenshot Viewer")
+ ATTRIB(XonoticScreenshotViewerDialog, name, string, "ScreenshotViewer")
+ ATTRIB(XonoticScreenshotViewerDialog, intendedWidth, float, 1)
+ ATTRIB(XonoticScreenshotViewerDialog, rows, float, 25)
+ ATTRIB(XonoticScreenshotViewerDialog, columns, float, 4)
+ ATTRIB(XonoticScreenshotViewerDialog, color, vector, SKINCOLOR_DIALOG_SCREENSHOTVIEWER)
+ ATTRIB(XonoticScreenshotViewerDialog, scrList, entity, NULL)
+ ATTRIB(XonoticScreenshotViewerDialog, screenshotImage, entity, NULL)
+ ATTRIB(XonoticScreenshotViewerDialog, slideShowButton, entity, NULL)
+ ATTRIB(XonoticScreenshotViewerDialog, currentScrPath, string, string_null)
+ENDCLASS(XonoticScreenshotViewerDialog)
-#ifndef DIALOG_MULTIPLAYER_PROFILE_H
-#define DIALOG_MULTIPLAYER_PROFILE_H
-#include "tab.qc"
-CLASS(XonoticProfileTab, XonoticTab)
- METHOD(XonoticProfileTab, fill, void(entity));
- METHOD(XonoticProfileTab, draw, void(entity));
- ATTRIB(XonoticProfileTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticProfileTab, rows, float, 23)
- ATTRIB(XonoticProfileTab, columns, float, 6.1) // added extra .2 for center space
- ATTRIB(XonoticProfileTab, playerNameLabel, entity, NULL)
- ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER)
-ENDCLASS(XonoticProfileTab)
-entity makeXonoticProfileTab();
-#endif
+#include "dialog_multiplayer_profile.qh"
+
+#include "playermodel.qh"
+#include "statslist.qh"
+#include "languagelist.qh"
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "inputbox.qh"
+#include "colorpicker.qh"
+#include "charmap.qh"
+#include "colorbutton.qh"
+#include "checkbox.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticProfileTab()
{
entity me;
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, profileApplyButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticProfileTab, XonoticTab)
+ METHOD(XonoticProfileTab, fill, void(entity));
+ METHOD(XonoticProfileTab, draw, void(entity));
+ ATTRIB(XonoticProfileTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticProfileTab, rows, float, 23)
+ ATTRIB(XonoticProfileTab, columns, float, 6.1) // added extra .2 for center space
+ ATTRIB(XonoticProfileTab, playerNameLabel, entity, NULL)
+ ATTRIB(XonoticProfileTab, playerNameLabelAlpha, float, SKINALPHA_HEADER)
+ENDCLASS(XonoticProfileTab)
+entity makeXonoticProfileTab();
-#ifndef DIALOG_QUIT_H
-#define DIALOG_QUIT_H
-#include "dialog.qc"
-CLASS(XonoticQuitDialog, XonoticDialog)
- METHOD(XonoticQuitDialog, fill, void(entity));
- ATTRIB(XonoticQuitDialog, title, string, _("Quit"))
- ATTRIB(XonoticQuitDialog, tooltip, string, _("Quit the game"))
- ATTRIB(XonoticQuitDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
- ATTRIB(XonoticQuitDialog, intendedWidth, float, 0.5)
- ATTRIB(XonoticQuitDialog, rows, float, 3)
- ATTRIB(XonoticQuitDialog, columns, float, 2)
- ATTRIB(XonoticQuitDialog, name, string, "Quit")
-ENDCLASS(XonoticQuitDialog)
-#endif
+#include "dialog_quit.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticQuitDialog_fill(entity me)
{
entity e;
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticQuitDialog, XonoticDialog)
+ METHOD(XonoticQuitDialog, fill, void(entity));
+ ATTRIB(XonoticQuitDialog, title, string, _("Quit"))
+ ATTRIB(XonoticQuitDialog, tooltip, string, _("Quit the game"))
+ ATTRIB(XonoticQuitDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+ ATTRIB(XonoticQuitDialog, intendedWidth, float, 0.5)
+ ATTRIB(XonoticQuitDialog, rows, float, 3)
+ ATTRIB(XonoticQuitDialog, columns, float, 2)
+ ATTRIB(XonoticQuitDialog, name, string, "Quit")
+ENDCLASS(XonoticQuitDialog)
-#ifndef DIALOG_SANDBOXTOOLS_H
-#define DIALOG_SANDBOXTOOLS_H
-#include "rootdialog.qc"
-CLASS(XonoticSandboxToolsDialog, XonoticRootDialog)
- METHOD(XonoticSandboxToolsDialog, fill, void(entity));
- ATTRIB(XonoticSandboxToolsDialog, title, string, _("Sandbox Tools"))
- ATTRIB(XonoticSandboxToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
- ATTRIB(XonoticSandboxToolsDialog, intendedWidth, float, 0.8)
- ATTRIB(XonoticSandboxToolsDialog, rows, float, 16)
- ATTRIB(XonoticSandboxToolsDialog, columns, float, 4)
- ATTRIB(XonoticSandboxToolsDialog, name, string, "SandboxTools")
- ATTRIB(XonoticSandboxToolsDialog, requiresConnection, float, true)
-ENDCLASS(XonoticSandboxToolsDialog)
-#endif
+#include "dialog_sandboxtools.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "commandbutton.qh"
+#include "colorpicker_string.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticSandboxToolsDialog_fill(entity me)
{
entity e, box;
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticSandboxToolsDialog, XonoticRootDialog)
+ METHOD(XonoticSandboxToolsDialog, fill, void(entity));
+ ATTRIB(XonoticSandboxToolsDialog, title, string, _("Sandbox Tools"))
+ ATTRIB(XonoticSandboxToolsDialog, color, vector, SKINCOLOR_DIALOG_SANDBOXTOOLS)
+ ATTRIB(XonoticSandboxToolsDialog, intendedWidth, float, 0.8)
+ ATTRIB(XonoticSandboxToolsDialog, rows, float, 16)
+ ATTRIB(XonoticSandboxToolsDialog, columns, float, 4)
+ ATTRIB(XonoticSandboxToolsDialog, name, string, "SandboxTools")
+ ATTRIB(XonoticSandboxToolsDialog, requiresConnection, float, true)
+ENDCLASS(XonoticSandboxToolsDialog)
-#ifndef DIALOG_SETTINGS_H
-#define DIALOG_SETTINGS_H
-#include "dialog.qc"
-CLASS(XonoticSettingsDialog, XonoticDialog)
- METHOD(XonoticSettingsDialog, fill, void(entity));
- ATTRIB(XonoticSettingsDialog, title, string, _("Settings"))
- ATTRIB(XonoticSettingsDialog, tooltip, string, _("Change the game settings"))
- ATTRIB(XonoticSettingsDialog, color, vector, SKINCOLOR_DIALOG_SETTINGS)
- ATTRIB(XonoticSettingsDialog, intendedWidth, float, 0.96)
- ATTRIB(XonoticSettingsDialog, rows, float, 18)
- ATTRIB(XonoticSettingsDialog, columns, float, 6)
-ENDCLASS(XonoticSettingsDialog)
-#endif
+#include "dialog_settings.qh"
+
+#include "dialog_settings_video.qh"
+#include "dialog_settings_effects.qh"
+#include "dialog_settings_audio.qh"
+#include "dialog_settings_game.qh"
+#include "dialog_settings_input.qh"
+#include "dialog_settings_user.qh"
+#include "dialog_settings_misc.qh"
+
+#include "tabcontroller.qh"
-#ifdef IMPLEMENTATION
void XonoticSettingsDialog_fill(entity me)
{
entity mc;
me.gotoRC(me, 2.5, 0);
me.TD(me, me.rows - 2.5, me.columns, mc);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticSettingsDialog, XonoticDialog)
+ METHOD(XonoticSettingsDialog, fill, void(entity));
+ ATTRIB(XonoticSettingsDialog, title, string, _("Settings"))
+ ATTRIB(XonoticSettingsDialog, tooltip, string, _("Change the game settings"))
+ ATTRIB(XonoticSettingsDialog, color, vector, SKINCOLOR_DIALOG_SETTINGS)
+ ATTRIB(XonoticSettingsDialog, intendedWidth, float, 0.96)
+ ATTRIB(XonoticSettingsDialog, rows, float, 18)
+ ATTRIB(XonoticSettingsDialog, columns, float, 6)
+ENDCLASS(XonoticSettingsDialog)
-#ifndef DIALOG_SETTINGS_AUDIO_H
-#define DIALOG_SETTINGS_AUDIO_H
-#include "tab.qc"
-CLASS(XonoticAudioSettingsTab, XonoticTab)
- METHOD(XonoticAudioSettingsTab, fill, void(entity));
- ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
- ATTRIB(XonoticAudioSettingsTab, hiddenMenuSoundsSlider, entity, NULL)
-ENDCLASS(XonoticAudioSettingsTab)
-entity makeXonoticAudioSettingsTab();
-#endif
+#include "dialog_settings_audio.qh"
+
+#include "slider_decibels.qh"
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "checkbox_slider_invalid.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticAudioSettingsTab()
{
entity me;
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, audioApplyButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticAudioSettingsTab, XonoticTab)
+ METHOD(XonoticAudioSettingsTab, fill, void(entity));
+ ATTRIB(XonoticAudioSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticAudioSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticAudioSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticAudioSettingsTab, hiddenMenuSoundsSlider, entity, NULL)
+ENDCLASS(XonoticAudioSettingsTab)
+entity makeXonoticAudioSettingsTab();
-#ifndef DIALOG_SETTINGS_EFFECTS_H
-#define DIALOG_SETTINGS_EFFECTS_H
-#include "tab.qc"
-CLASS(XonoticEffectsSettingsTab, XonoticTab)
- METHOD(XonoticEffectsSettingsTab, fill, void(entity));
- ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticEffectsSettingsTab)
-entity makeXonoticEffectsSettingsTab();
-#endif
+#include "dialog_settings_effects.qh"
+
+#include "slider_picmip.qh"
+#include "slider_particles.qh"
+#include "slider_sbfadetime.qh"
+#include "weaponslist.qh"
+#include "keybinder.qh"
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
+#include "checkbox_slider_invalid.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticEffectsSettingsTab()
{
entity me;
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, effectsApplyButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticEffectsSettingsTab, XonoticTab)
+ METHOD(XonoticEffectsSettingsTab, fill, void(entity));
+ ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ENDCLASS(XonoticEffectsSettingsTab)
+entity makeXonoticEffectsSettingsTab();
-#ifndef DIALOG_SETTINGS_GAME_H
-#define DIALOG_SETTINGS_GAME_H
+#include "dialog_settings_game.qh"
#include "../gamesettings.qh"
-#include "datasource.qc"
-CLASS(SettingSource, DataSource)
- METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns))
+METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns))
+{
+ Lazy l = Settings_from(i);
+ entity it = l.m_get();
+ if (returns) returns(it.title, string_null);
+ return it;
+}
+METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns))
+{
+ Lazy l = Settings_from(i);
+ entity it = l.m_get();
+ if (returns) returns(it.tooltip);
+ return it;
+}
+METHOD(SettingSource, reload, int(entity this, string filter)) { return Settings_COUNT; }
+
+string XonoticRegisteredSettingsList_cb_name;
+string XonoticRegisteredSettingsList_cb_tooltip;
+void XonoticRegisteredSettingsList_getNameIcon_cb(string _name, string _icon)
+{
+ XonoticRegisteredSettingsList_cb_name = _name;
+}
+void XonoticRegisteredSettingsList_getTooltip_cb(string _tooltip)
+{
+ XonoticRegisteredSettingsList_cb_tooltip = _tooltip;
+}
+
+METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused))
+{
+ if (!this.source) return;
+ if (!this.source.getEntry(this.source, i, XonoticRegisteredSettingsList_getNameIcon_cb)) return;
+ string name = XonoticRegisteredSettingsList_cb_name;
+ if (isSelected) {
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+ } else if (isFocused) {
+ this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
+ draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
+ }
+ string s = draw_TextShortenToWidth(strdecolorize(name), 1, 0, this.realFontSize);
+ draw_Text(this.realUpperMargin * eY + (0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+}
+
+METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this))
+{
+ if (this.focusedItem == -1 || !this.source)
{
- Lazy l = Settings_from(i);
- entity it = l.m_get();
- if (returns) returns(it.title, string_null);
- return it;
+ clearTooltip(this);
+ return;
}
- METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns))
+ if (!this.source.getEntryTooltip(this, this.focusedItem, XonoticRegisteredSettingsList_getTooltip_cb))
{
- Lazy l = Settings_from(i);
- entity it = l.m_get();
- if (returns) returns(it.tooltip);
- return it;
+ clearTooltip(this);
+ return;
}
- METHOD(SettingSource, reload, int(entity this, string filter)) { return Settings_COUNT; }
-ENDCLASS(SettingSource)
-
-#include "listbox.qc"
-CLASS(XonoticRegisteredSettingsList, XonoticListBox)
- ATTRIB(XonoticRegisteredSettingsList, alphaBG, float, 0)
- ATTRIB(XonoticRegisteredSettingsList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticRegisteredSettingsList, origin, vector, '0 0 0')
- ATTRIB(XonoticRegisteredSettingsList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticRegisteredSettingsList, realUpperMargin, float, 0)
- ATTRIB(XonoticRegisteredSettingsList, rowsPerItem, float, 2)
- ATTRIB(XonoticRegisteredSettingsList, stringFilterBox, entity, NULL)
- ATTRIB(XonoticRegisteredSettingsList, stringFilter, string, string_null)
- ATTRIB(XonoticRegisteredSettingsList, typeToSearchString, string, string_null)
- ATTRIB(XonoticRegisteredSettingsList, typeToSearchTime, float, 0)
- ATTRIB(XonoticRegisteredSettingsList, source, DataSource, NULL)
- ATTRIB(XonoticRegisteredSettingsList, onChange, void(entity, entity), func_null)
- ATTRIB(XonoticRegisteredSettingsList, onChangeEntity, entity, NULL)
- METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity));
-
- string XonoticRegisteredSettingsList_cb_name;
- string XonoticRegisteredSettingsList_cb_tooltip;
- void XonoticRegisteredSettingsList_getNameIcon_cb(string _name, string _icon)
- {
- XonoticRegisteredSettingsList_cb_name = _name;
- }
- void XonoticRegisteredSettingsList_getTooltip_cb(string _tooltip)
- {
- XonoticRegisteredSettingsList_cb_tooltip = _tooltip;
- }
+ string theTooltip = XonoticRegisteredSettingsList_cb_tooltip;
+ if(theTooltip != "")
+ setZonedTooltip(this, theTooltip, string_null);
+ else
+ clearTooltip(this);
+}
- METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused))
- {
- if (!this.source) return;
- if (!this.source.getEntry(this.source, i, XonoticRegisteredSettingsList_getNameIcon_cb)) return;
- string name = XonoticRegisteredSettingsList_cb_name;
- if (isSelected) {
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
- } else if (isFocused) {
- this.focusedItemAlpha = getFadedAlpha(this.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
- draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, this.focusedItemAlpha);
- }
- string s = draw_TextShortenToWidth(strdecolorize(name), 1, 0, this.realFontSize);
- draw_Text(this.realUpperMargin * eY + (0.5 * this.realFontSize.x) * eX, s, this.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
- }
-
- METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this))
- {
- if (this.focusedItem == -1 || !this.source)
- {
- clearTooltip(this);
- return;
- }
- if (!this.source.getEntryTooltip(this, this.focusedItem, XonoticRegisteredSettingsList_getTooltip_cb))
- {
- clearTooltip(this);
- return;
- }
- string theTooltip = XonoticRegisteredSettingsList_cb_tooltip;
- if(theTooltip != "")
- setZonedTooltip(this, theTooltip, string_null);
- else
- clearTooltip(this);
- }
+METHOD(XonoticRegisteredSettingsList, refilter, void(entity this))
+{
+ if (!this.source) {
+ this.nItems = 0;
+ return;
+ }
+ this.nItems = this.source.reload(this.source, this.stringFilter);
+}
+METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
+{
+ SUPER(XonoticRegisteredSettingsList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
- METHOD(XonoticRegisteredSettingsList, refilter, void(entity this))
- {
- if (!this.source) {
- this.nItems = 0;
- return;
- }
- this.nItems = this.source.reload(this.source, this.stringFilter);
- }
- METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
- {
- SUPER(XonoticRegisteredSettingsList).resizeNotify(this, relOrigin, relSize, absOrigin, absSize);
+ this.itemAbsSize = '0 0 0';
+ this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
+ this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
+ this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
+}
+METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i))
+{
+ SUPER(XonoticRegisteredSettingsList).setSelected(this, i);
+ this.onChange(this, this.onChangeEntity);
+}
+CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source) {
+ CONSTRUCT(XonoticRegisteredSettingsList);
+ this.source = _source;
+ this.configureXonoticListBox(this);
+ this.refilter(this);
+}
- this.itemAbsSize = '0 0 0';
- this.realFontSize_y = this.fontSize / (this.itemAbsSize_y = (absSize.y * this.itemHeight));
- this.realFontSize_x = this.fontSize / (this.itemAbsSize_x = (absSize.x * (1 - this.controlWidth)));
- this.realUpperMargin = 0.5 * (1 - this.realFontSize.y);
- }
- METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i))
- {
- SUPER(XonoticRegisteredSettingsList).setSelected(this, i);
- this.onChange(this, this.onChangeEntity);
- }
- CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source) {
- CONSTRUCT(XonoticRegisteredSettingsList);
- this.source = _source;
- this.configureXonoticListBox(this);
- this.refilter(this);
+METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this))
+{
+ entity c = this.currentPanel;
+ entity removing = this.currentItem;
+ DataSource data = this.topicList.source;
+ entity adding = data.getEntry(data, this.topicList.selectedItem, func_null);
+ if (removing == adding) return;
+ if (removing) {
+ this.currentItem = NULL;
+ c.removeItem(c, removing);
}
-ENDCLASS(XonoticRegisteredSettingsList)
-
-#include "tab.qc"
-CLASS(XonoticGameSettingsTab, XonoticTab)
- ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
- ATTRIB(XonoticGameSettingsTab, source, DataSource, NEW(SettingSource))
- ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, this.source))
- ATTRIB(XonoticGameSettingsTab, currentPanel, entity, NEW(XonoticTab))
- ATTRIB(XonoticGameSettingsTab, currentItem, entity, NULL)
- METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this))
- {
- entity c = this.currentPanel;
- entity removing = this.currentItem;
- DataSource data = this.topicList.source;
- entity adding = data.getEntry(data, this.topicList.selectedItem, func_null);
- if (removing == adding) return;
- if (removing) {
- this.currentItem = NULL;
- c.removeItem(c, removing);
- }
- if (adding) {
- this.currentItem = adding;
- adding.resizeNotify(adding, '0 0 0', c.size, '0 0 0', c.size);
- c.addItem(c, adding, '0 0 0', '1 1 0', 1);
- }
- }
- METHOD(XonoticGameSettingsTab, fill, void(entity this))
- {
- entity topics = this.topicList;
- topics.onChange = this.topicChangeNotify;
- topics.onChangeEntity = this;
+ if (adding) {
+ this.currentItem = adding;
+ adding.resizeNotify(adding, '0 0 0', c.size, '0 0 0', c.size);
+ c.addItem(c, adding, '0 0 0', '1 1 0', 1);
+ }
+}
+METHOD(XonoticGameSettingsTab, fill, void(entity this))
+{
+ entity topics = this.topicList;
+ topics.onChange = this.topicChangeNotify;
+ topics.onChangeEntity = this;
- int
- col = 0, width = 1;
- this.gotoRC(this, 0, col);
- this.TD(this, this.rows, width, topics);
+ int
+ col = 0, width = 1;
+ this.gotoRC(this, 0, col);
+ this.TD(this, this.rows, width, topics);
- col += width, width = this.columns - col;
- this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
- this.TD(this, this.rows, width, this.currentPanel);
+ col += width, width = this.columns - col;
+ this.gotoRC(this, 0, col); this.setFirstColumn(this, this.currentColumn);
+ this.TD(this, this.rows, width, this.currentPanel);
- this.topicChangeNotify(topics, this);
- }
- INIT(XonoticGameSettingsTab)
- {
- this.configureDialog(this);
- }
-ENDCLASS(XonoticGameSettingsTab)
-#endif
+ this.topicChangeNotify(topics, this);
+}
--- /dev/null
+#pragma once
+
+#include "datasource.qh"
+CLASS(SettingSource, DataSource)
+ METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns));
+ METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns));
+ METHOD(SettingSource, reload, int(entity this, string filter));
+ENDCLASS(SettingSource)
+
+#include "listbox.qh"
+CLASS(XonoticRegisteredSettingsList, XonoticListBox)
+ ATTRIB(XonoticRegisteredSettingsList, alphaBG, float, 0)
+ ATTRIB(XonoticRegisteredSettingsList, itemAbsSize, vector, '0 0 0')
+ ATTRIB(XonoticRegisteredSettingsList, origin, vector, '0 0 0')
+ ATTRIB(XonoticRegisteredSettingsList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticRegisteredSettingsList, realUpperMargin, float, 0)
+ ATTRIB(XonoticRegisteredSettingsList, rowsPerItem, float, 2)
+ ATTRIB(XonoticRegisteredSettingsList, stringFilterBox, entity, NULL)
+ ATTRIB(XonoticRegisteredSettingsList, stringFilter, string, string_null)
+ ATTRIB(XonoticRegisteredSettingsList, typeToSearchString, string, string_null)
+ ATTRIB(XonoticRegisteredSettingsList, typeToSearchTime, float, 0)
+ ATTRIB(XonoticRegisteredSettingsList, source, DataSource, NULL)
+ ATTRIB(XonoticRegisteredSettingsList, onChange, void(entity, entity), func_null)
+ ATTRIB(XonoticRegisteredSettingsList, onChangeEntity, entity, NULL)
+ METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity));
+ METHOD(XonoticRegisteredSettingsList, drawListBoxItem, void(entity this, int i, vector absSize, bool isSelected, bool isFocused));
+ METHOD(XonoticRegisteredSettingsList, focusedItemChangeNotify, void(entity this));
+ METHOD(XonoticRegisteredSettingsList, refilter, void(entity this));
+ METHOD(XonoticRegisteredSettingsList, resizeNotify, void(entity this, vector relOrigin, vector relSize, vector absOrigin, vector absSize));
+ METHOD(XonoticRegisteredSettingsList, setSelected, void(entity this, int i));
+ CONSTRUCTOR(XonoticRegisteredSettingsList, DataSource _source);
+ENDCLASS(XonoticRegisteredSettingsList)
+
+#include "tab.qh"
+CLASS(XonoticGameSettingsTab, XonoticTab)
+ ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
+ ATTRIB(XonoticGameSettingsTab, source, DataSource, NEW(SettingSource))
+ ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, this.source))
+ ATTRIB(XonoticGameSettingsTab, currentPanel, entity, NEW(XonoticTab))
+ ATTRIB(XonoticGameSettingsTab, currentItem, entity, NULL)
+ METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this));
+ METHOD(XonoticGameSettingsTab, fill, void(entity this));
+ INIT(XonoticGameSettingsTab)
+ {
+ this.configureDialog(this);
+ }
+ENDCLASS(XonoticGameSettingsTab)
-#ifndef DIALOG_SETTINGS_GAME_CROSSHAIR_H
-#define DIALOG_SETTINGS_GAME_CROSSHAIR_H
-#include "tab.qc"
-CLASS(XonoticGameCrosshairSettingsTab, XonoticTab)
- METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity));
- METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity));
- ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
- ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameCrosshairSettingsTab)
-entity makeXonoticGameCrosshairSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Crosshair, makeXonoticGameCrosshairSettingsTab());
-#endif
+#include "dialog_settings_game_crosshair.qh"
+
+#include "radiobutton.qh"
+#include "crosshairpicker.qh"
+#include "crosshairpreview.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "colorpicker_string.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
-#ifdef IMPLEMENTATION
void XonoticGameCrosshairSettingsTab_showNotify(entity me)
{
loadAllCvars(me);
me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.25, 0, "crosshair_pickup", _("Animate crosshair when picking up an item")));
setDependent(e, "crosshair_enabled", 1, 2);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameCrosshairSettingsTab, XonoticTab)
+ METHOD(XonoticGameCrosshairSettingsTab, fill, void(entity));
+ METHOD(XonoticGameCrosshairSettingsTab, showNotify, void(entity));
+ ATTRIB(XonoticGameCrosshairSettingsTab, title, string, _("Crosshair"))
+ ATTRIB(XonoticGameCrosshairSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameCrosshairSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameCrosshairSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameCrosshairSettingsTab)
+entity makeXonoticGameCrosshairSettingsTab();
+
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Crosshair, makeXonoticGameCrosshairSettingsTab());
-#ifndef DIALOG_SETTINGS_GAME_HUD_H
-#define DIALOG_SETTINGS_GAME_HUD_H
-#include "tab.qc"
-CLASS(XonoticGameHUDSettingsTab, XonoticTab)
- METHOD(XonoticGameHUDSettingsTab, fill, void(entity));
- METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity));
- ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD"))
- ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameHUDSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameHUDSettingsTab)
-entity makeXonoticGameHUDSettingsTab();
-void HUDSetup_Start(entity me, entity btn);
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(HUD, makeXonoticGameHUDSettingsTab());
-#endif
+#include "dialog_settings_game_hud.qh"
+
+#include "../item/modalcontroller.qh"
+#include "mainwindow.qh"
+#include "textlabel.qh"
+#include "slider.qh"
+#include "slider_sbfadetime.qh"
+#include "checkbox.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void HUDSetup_Check_Gamestatus(entity me, entity btn)
{
if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, ask the player if they want to start one anyway
e.onClickEntity = me;
// TODO: show hud config name with text here
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameHUDSettingsTab, XonoticTab)
+ METHOD(XonoticGameHUDSettingsTab, fill, void(entity));
+ METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity));
+ ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD"))
+ ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameHUDSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameHUDSettingsTab)
+entity makeXonoticGameHUDSettingsTab();
+void HUDSetup_Start(entity me, entity btn);
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(HUD, makeXonoticGameHUDSettingsTab());
-#ifndef DIALOG_SETTINGS_GAME_HUDCONFIRM_H
-#define DIALOG_SETTINGS_GAME_HUDCONFIRM_H
-#include "dialog.qc"
-CLASS(XonoticHUDConfirmDialog, XonoticDialog)
- METHOD(XonoticHUDConfirmDialog, fill, void(entity));
- ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
- ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
- ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
- ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
- ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
-ENDCLASS(XonoticHUDConfirmDialog)
-#endif
+#include "dialog_settings_game_hudconfirm.qh"
+
+#include "textlabel.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void HUDSetup_Start(entity me, entity btn)
{
if (!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticHUDConfirmDialog, XonoticDialog)
+ METHOD(XonoticHUDConfirmDialog, fill, void(entity));
+ ATTRIB(XonoticHUDConfirmDialog, title, string, _("Enter HUD editor"))
+ ATTRIB(XonoticHUDConfirmDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+ ATTRIB(XonoticHUDConfirmDialog, intendedWidth, float, 0.5)
+ ATTRIB(XonoticHUDConfirmDialog, rows, float, 4)
+ ATTRIB(XonoticHUDConfirmDialog, columns, float, 2)
+ENDCLASS(XonoticHUDConfirmDialog)
-#ifndef DIALOG_SETTINGS_GAME_MESSAGES_H
-#define DIALOG_SETTINGS_GAME_MESSAGES_H
-#include "tab.qc"
-CLASS(XonoticGameMessageSettingsTab, XonoticTab)
- METHOD(XonoticGameMessageSettingsTab, fill, void(entity));
- METHOD(XonoticGameMessageSettingsTab, showNotify, void(entity));
- ATTRIB(XonoticGameMessageSettingsTab, title, string, _("Messages"))
- ATTRIB(XonoticGameMessageSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameMessageSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameMessageSettingsTab, columns, float, 6)
- ATTRIB(XonoticGameMessageSettingsTab, weaponsList, entity, NULL)
-ENDCLASS(XonoticGameMessageSettingsTab)
-entity makeXonoticGameMessageSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Messages, makeXonoticGameMessageSettingsTab());
-#endif
+#include "dialog_settings_game_messages.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
-#ifdef IMPLEMENTATION
void XonoticGameMessageSettingsTab_showNotify(entity me)
{
loadAllCvars(me);
me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(1, 0, "notification_ANNCE_ACHIEVEMENT_AIRSHOT", _("Achievement sounds"), "-"));
makeMulti(e, "notification_ANNCE_ACHIEVEMENT_AMAZING notification_ANNCE_ACHIEVEMENT_AWESOME notification_ANNCE_ACHIEVEMENT_BOTLIKE notification_ANNCE_ACHIEVEMENT_ELECTROBITCH notification_ANNCE_ACHIEVEMENT_IMPRESSIVE notification_ANNCE_ACHIEVEMENT_YODA");
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameMessageSettingsTab, XonoticTab)
+ METHOD(XonoticGameMessageSettingsTab, fill, void(entity));
+ METHOD(XonoticGameMessageSettingsTab, showNotify, void(entity));
+ ATTRIB(XonoticGameMessageSettingsTab, title, string, _("Messages"))
+ ATTRIB(XonoticGameMessageSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameMessageSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameMessageSettingsTab, columns, float, 6)
+ ATTRIB(XonoticGameMessageSettingsTab, weaponsList, entity, NULL)
+ENDCLASS(XonoticGameMessageSettingsTab)
+entity makeXonoticGameMessageSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Messages, makeXonoticGameMessageSettingsTab());
-#ifndef DIALOG_SETTINGS_GAME_MODEL_H
-#define DIALOG_SETTINGS_GAME_MODEL_H
-#include "tab.qc"
-CLASS(XonoticGameModelSettingsTab, XonoticTab)
- METHOD(XonoticGameModelSettingsTab, fill, void(entity));
- METHOD(XonoticGameModelSettingsTab, showNotify, void(entity));
- ATTRIB(XonoticGameModelSettingsTab, title, string, _("Models"))
- ATTRIB(XonoticGameModelSettingsTab, tooltip, string, _("Customize how players and items are displayed in game"))
- ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameModelSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
-ENDCLASS(XonoticGameModelSettingsTab)
-entity makeXonoticGameModelSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Models, makeXonoticGameModelSettingsTab());
-#endif
+#include "dialog_settings_game_model.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
-#ifdef IMPLEMENTATION
void XonoticGameModelSettingsTab_showNotify(entity me)
{
loadAllCvars(me);
e.configureXonoticTextSliderValues(e);
setDependent(e, "cl_gentle", 0, 0);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameModelSettingsTab, XonoticTab)
+ METHOD(XonoticGameModelSettingsTab, fill, void(entity));
+ METHOD(XonoticGameModelSettingsTab, showNotify, void(entity));
+ ATTRIB(XonoticGameModelSettingsTab, title, string, _("Models"))
+ ATTRIB(XonoticGameModelSettingsTab, tooltip, string, _("Customize how players and items are displayed in game"))
+ ATTRIB(XonoticGameModelSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameModelSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameModelSettingsTab, columns, float, 5)
+ENDCLASS(XonoticGameModelSettingsTab)
+entity makeXonoticGameModelSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Models, makeXonoticGameModelSettingsTab());
-#ifndef DIALOG_SETTINGS_GAME_VIEW_H
-#define DIALOG_SETTINGS_GAME_VIEW_H
-#include "tab.qc"
-CLASS(XonoticGameViewSettingsTab, XonoticTab)
- METHOD(XonoticGameViewSettingsTab, fill, void(entity));
- METHOD(XonoticGameViewSettingsTab, showNotify, void(entity));
- ATTRIB(XonoticGameViewSettingsTab, title, string, _("View"))
- ATTRIB(XonoticGameViewSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameViewSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameViewSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticGameViewSettingsTab)
-entity makeXonoticGameViewSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(View, makeXonoticGameViewSettingsTab());
-#endif
+#include "dialog_settings_game_view.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticGameViewSettingsTab_showNotify(entity me)
{
loadAllCvars(me);
//me.TDempty(me, 0.2);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_unpress_zoom_on_weapon_switch", _("Release zoom when you switch weapons")));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameViewSettingsTab, XonoticTab)
+ METHOD(XonoticGameViewSettingsTab, fill, void(entity));
+ METHOD(XonoticGameViewSettingsTab, showNotify, void(entity));
+ ATTRIB(XonoticGameViewSettingsTab, title, string, _("View"))
+ ATTRIB(XonoticGameViewSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameViewSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameViewSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticGameViewSettingsTab)
+entity makeXonoticGameViewSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(View, makeXonoticGameViewSettingsTab());
-#ifndef DIALOG_SETTINGS_GAME_WEAPONS_H
-#define DIALOG_SETTINGS_GAME_WEAPONS_H
-#include "tab.qc"
-CLASS(XonoticGameWeaponsSettingsTab, XonoticTab)
- METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity));
- METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity));
- ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
- ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
- ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
-ENDCLASS(XonoticGameWeaponsSettingsTab)
-entity makeXonoticGameWeaponsSettingsTab();
-#include "../gamesettings.qh"
-REGISTER_SETTINGS(Weapons, makeXonoticGameWeaponsSettingsTab());
-#endif
+#include "dialog_settings_game_weapons.qh"
+
+#include "weaponslist.qh"
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "button.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
void XonoticGameWeaponsSettingsTab_showNotify(entity me)
{
loadAllCvars(me);
me.gotoRC(me, me.rows - 1, 0); me.setFirstColumn(me, me.currentColumn);
me.TD(me, 1, me.columns, weaponsApplyButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticGameWeaponsSettingsTab, XonoticTab)
+ METHOD(XonoticGameWeaponsSettingsTab, fill, void(entity));
+ METHOD(XonoticGameWeaponsSettingsTab, showNotify, void(entity));
+ ATTRIB(XonoticGameWeaponsSettingsTab, title, string, _("Weapons"))
+ ATTRIB(XonoticGameWeaponsSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticGameWeaponsSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticGameWeaponsSettingsTab, columns, float, 6)
+ ATTRIB(XonoticGameWeaponsSettingsTab, weaponsList, entity, NULL)
+ENDCLASS(XonoticGameWeaponsSettingsTab)
+entity makeXonoticGameWeaponsSettingsTab();
+#include "../gamesettings.qh"
+REGISTER_SETTINGS(Weapons, makeXonoticGameWeaponsSettingsTab());
-#ifndef DIALOG_SETTINGS_INPUT_H
-#define DIALOG_SETTINGS_INPUT_H
-#include "tab.qc"
-CLASS(XonoticInputSettingsTab, XonoticTab)
- METHOD(XonoticInputSettingsTab, fill, void(entity));
- ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
-ENDCLASS(XonoticInputSettingsTab)
-entity makeXonoticInputSettingsTab();
-#endif
+#include "dialog_settings_input.qh"
+
+#include "dialog_settings_input_userbind.qh"
+#include "skinlist.qh"
+#include "slider_resolution.qh"
+#include "../item/checkbox.qh"
+#include "keybinder.qh"
+#include "textlabel.qh"
+#include "button.qh"
+#include "slider.qh"
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticInputSettingsTab()
{
entity me;
e.disabled = 1; // the option is never available in this case, just there for show
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticInputSettingsTab, XonoticTab)
+ METHOD(XonoticInputSettingsTab, fill, void(entity));
+ ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ENDCLASS(XonoticInputSettingsTab)
+entity makeXonoticInputSettingsTab();
-#ifndef DIALOG_SETTINGS_INPUT_USERBIND_H
-#define DIALOG_SETTINGS_INPUT_USERBIND_H
-#include "dialog.qc"
-CLASS(XonoticUserbindEditDialog, XonoticDialog)
- METHOD(XonoticUserbindEditDialog, loadUserBind, void(entity, string, string, string));
- METHOD(XonoticUserbindEditDialog, fill, void(entity));
- ATTRIB(XonoticUserbindEditDialog, title, string, _("User defined key bind"))
- ATTRIB(XonoticUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
- ATTRIB(XonoticUserbindEditDialog, intendedWidth, float, 0.7)
- ATTRIB(XonoticUserbindEditDialog, rows, float, 4)
- ATTRIB(XonoticUserbindEditDialog, columns, float, 3)
- ATTRIB(XonoticUserbindEditDialog, keybindBox, entity, NULL)
+#include "dialog_settings_input_userbind.qh"
- ATTRIB(XonoticUserbindEditDialog, nameBox, entity, NULL)
- ATTRIB(XonoticUserbindEditDialog, commandPressBox, entity, NULL)
- ATTRIB(XonoticUserbindEditDialog, commandReleaseBox, entity, NULL)
-ENDCLASS(XonoticUserbindEditDialog)
-#endif
+#include "keybinder.qh"
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticUserbindEditDialog_Save(entity btn, entity me)
{
me.keybindBox.editUserbind(me.keybindBox, me.nameBox.text, me.commandPressBox.text, me.commandReleaseBox.text);
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticUserbindEditDialog, XonoticDialog)
+ METHOD(XonoticUserbindEditDialog, loadUserBind, void(entity, string, string, string));
+ METHOD(XonoticUserbindEditDialog, fill, void(entity));
+ ATTRIB(XonoticUserbindEditDialog, title, string, _("User defined key bind"))
+ ATTRIB(XonoticUserbindEditDialog, color, vector, SKINCOLOR_DIALOG_USERBIND)
+ ATTRIB(XonoticUserbindEditDialog, intendedWidth, float, 0.7)
+ ATTRIB(XonoticUserbindEditDialog, rows, float, 4)
+ ATTRIB(XonoticUserbindEditDialog, columns, float, 3)
+ ATTRIB(XonoticUserbindEditDialog, keybindBox, entity, NULL)
+
+ ATTRIB(XonoticUserbindEditDialog, nameBox, entity, NULL)
+ ATTRIB(XonoticUserbindEditDialog, commandPressBox, entity, NULL)
+ ATTRIB(XonoticUserbindEditDialog, commandReleaseBox, entity, NULL)
+ENDCLASS(XonoticUserbindEditDialog)
-#ifndef DIALOG_SETTINGS_MISC_H
-#define DIALOG_SETTINGS_MISC_H
-#include "tab.qc"
-CLASS(XonoticMiscSettingsTab, XonoticTab)
- METHOD(XonoticMiscSettingsTab, fill, void(entity));
- ATTRIB(XonoticMiscSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticMiscSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticMiscSettingsTab, columns, float, 6.2)
-ENDCLASS(XonoticMiscSettingsTab)
-entity makeXonoticMiscSettingsTab();
-#endif
+#include "dialog_settings_misc.qh"
+
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "textslider.qh"
+#include "slider.qh"
+#include "checkbox.qh"
+#include "button.qh"
+#include "mainwindow.qh"
-#ifdef IMPLEMENTATION
#define ADDVALUE_FPS(i) e.addValue(e, strzone(sprintf(_("%d fps"), i)), #i)
entity makeXonoticMiscSettingsTab()
{
e.onClickEntity = main.resetDialog;
}
#undef ADDVALUE_FPS
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticMiscSettingsTab, XonoticTab)
+ METHOD(XonoticMiscSettingsTab, fill, void(entity));
+ ATTRIB(XonoticMiscSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticMiscSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticMiscSettingsTab, columns, float, 6.2)
+ENDCLASS(XonoticMiscSettingsTab)
+entity makeXonoticMiscSettingsTab();
-#ifndef DIALOG_SETTINGS_MISC_CVARS_H
-#define DIALOG_SETTINGS_MISC_CVARS_H
-#include "dialog.qc"
-CLASS(XonoticCvarsDialog, XonoticDialog)
- METHOD(XonoticCvarsDialog, fill, void(entity));
- METHOD(XonoticCvarsDialog, showNotify, void(entity));
- ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
- ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
- ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
- ATTRIB(XonoticCvarsDialog, rows, float, 24)
- ATTRIB(XonoticCvarsDialog, columns, float, 6)
-ENDCLASS(XonoticCvarsDialog)
-#endif
+#include "dialog_settings_misc_cvars.qh"
+
+#include "cvarlist.qh"
+#include "textlabel.qh"
+#include "inputbox.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticCvarsDialog_showNotify(entity me)
{
SUPER(XonoticCvarsDialog).showNotify(me);
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticCvarsDialog, XonoticDialog)
+ METHOD(XonoticCvarsDialog, fill, void(entity));
+ METHOD(XonoticCvarsDialog, showNotify, void(entity));
+ ATTRIB(XonoticCvarsDialog, title, string, _("Advanced settings"))
+ ATTRIB(XonoticCvarsDialog, color, vector, SKINCOLOR_DIALOG_CVARS)
+ ATTRIB(XonoticCvarsDialog, intendedWidth, float, 0.8)
+ ATTRIB(XonoticCvarsDialog, rows, float, 24)
+ ATTRIB(XonoticCvarsDialog, columns, float, 6)
+ENDCLASS(XonoticCvarsDialog)
-#ifndef DIALOG_SETTINGS_MISC_RESET_H
-#define DIALOG_SETTINGS_MISC_RESET_H
-#include "dialog.qc"
-CLASS(XonoticResetDialog, XonoticDialog)
- METHOD(XonoticResetDialog, fill, void(entity));
- ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
- ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
- ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
- ATTRIB(XonoticResetDialog, rows, float, 4)
- ATTRIB(XonoticResetDialog, columns, float, 2)
- ATTRIB(XonoticResetDialog, name, string, "Factory reset")
-ENDCLASS(XonoticResetDialog)
-#endif
+#include "dialog_settings_misc_reset.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticResetDialog_fill(entity me)
{
entity e;
e.onClick = Dialog_Close;
e.onClickEntity = me;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticResetDialog, XonoticDialog)
+ METHOD(XonoticResetDialog, fill, void(entity));
+ ATTRIB(XonoticResetDialog, title, string, _("Factory reset"))
+ ATTRIB(XonoticResetDialog, color, vector, SKINCOLOR_DIALOG_QUIT)
+ ATTRIB(XonoticResetDialog, intendedWidth, float, 0.5)
+ ATTRIB(XonoticResetDialog, rows, float, 4)
+ ATTRIB(XonoticResetDialog, columns, float, 2)
+ ATTRIB(XonoticResetDialog, name, string, "Factory reset")
+ENDCLASS(XonoticResetDialog)
-#ifndef DIALOG_SETTINGS_USER_H
-#define DIALOG_SETTINGS_USER_H
-#include "tab.qc"
-CLASS(XonoticUserSettingsTab, XonoticTab)
- METHOD(XonoticUserSettingsTab, fill, void(entity));
- ATTRIB(XonoticUserSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticUserSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticUserSettingsTab, columns, float, 6)
-ENDCLASS(XonoticUserSettingsTab)
-entity makeXonoticUserSettingsTab();
-#endif
+#include "dialog_settings_user.qh"
+
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "languagelist.qh"
+#include "skinlist.qh"
+#include "checkbox.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticUserSettingsTab()
{
entity me;
me.TD(me, 1, 6, userApplyButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticUserSettingsTab, XonoticTab)
+ METHOD(XonoticUserSettingsTab, fill, void(entity));
+ ATTRIB(XonoticUserSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticUserSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticUserSettingsTab, columns, float, 6)
+ENDCLASS(XonoticUserSettingsTab)
+entity makeXonoticUserSettingsTab();
-#ifndef DIALOG_SETTINGS_USER_LANGUAGEWARNING_H
-#define DIALOG_SETTINGS_USER_LANGUAGEWARNING_H
-#include "dialog.qc"
-CLASS(XonoticLanguageWarningDialog, XonoticDialog)
- METHOD(XonoticLanguageWarningDialog, fill, void(entity));
- ATTRIB(XonoticLanguageWarningDialog, title, string, _("Warning"))
- ATTRIB(XonoticLanguageWarningDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
- ATTRIB(XonoticLanguageWarningDialog, intendedWidth, float, 0.6)
- ATTRIB(XonoticLanguageWarningDialog, rows, float, 5)
- ATTRIB(XonoticLanguageWarningDialog, columns, float, 4)
-ENDCLASS(XonoticLanguageWarningDialog)
-#endif
+#include "dialog_settings_user_languagewarning.qh"
+
+#include "textlabel.qh"
+#include "commandbutton.qh"
-#ifdef IMPLEMENTATION
void XonoticLanguageWarningDialog_fill(entity me)
{
entity e;
me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Disconnect now"), '0 0 0', "disconnect", 0));
me.TD(me, 1, 2, e = makeXonoticCommandButton(_("Switch language"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; menu_restart; menu_cmd languageselect", 0));
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticLanguageWarningDialog, XonoticDialog)
+ METHOD(XonoticLanguageWarningDialog, fill, void(entity));
+ ATTRIB(XonoticLanguageWarningDialog, title, string, _("Warning"))
+ ATTRIB(XonoticLanguageWarningDialog, color, vector, SKINCOLOR_DIALOG_HUDCONFIRM)
+ ATTRIB(XonoticLanguageWarningDialog, intendedWidth, float, 0.6)
+ ATTRIB(XonoticLanguageWarningDialog, rows, float, 5)
+ ATTRIB(XonoticLanguageWarningDialog, columns, float, 4)
+ENDCLASS(XonoticLanguageWarningDialog)
-#ifndef DIALOG_SETTINGS_VIDEO_H
-#define DIALOG_SETTINGS_VIDEO_H
-#include "tab.qc"
-CLASS(XonoticVideoSettingsTab, XonoticTab)
- METHOD(XonoticVideoSettingsTab, fill, void(entity));
- ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
- ATTRIB(XonoticVideoSettingsTab, rows, float, 15.5)
- ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
- ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
-ENDCLASS(XonoticVideoSettingsTab)
-entity makeXonoticVideoSettingsTab();
-#endif
+#include "dialog_settings_video.qh"
+
+#include "commandbutton.qh"
+#include "textlabel.qh"
+#include "textslider.qh"
+#include "checkbox.qh"
+#include "slider.qh"
+#include "slider_resolution.qh"
+#include "radiobutton.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticVideoSettingsTab()
{
entity me;
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, videoApplyButton);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "tab.qh"
+CLASS(XonoticVideoSettingsTab, XonoticTab)
+ METHOD(XonoticVideoSettingsTab, fill, void(entity));
+ ATTRIB(XonoticVideoSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(XonoticVideoSettingsTab, rows, float, 15.5)
+ ATTRIB(XonoticVideoSettingsTab, columns, float, 6.2) // added extra .2 for center space
+ ATTRIB(XonoticVideoSettingsTab, name, string, "videosettings")
+ENDCLASS(XonoticVideoSettingsTab)
+entity makeXonoticVideoSettingsTab();
-#ifndef DIALOG_SINGLEPLAYER_H
-#define DIALOG_SINGLEPLAYER_H
-#include "dialog.qc"
-CLASS(XonoticSingleplayerDialog, XonoticDialog)
- METHOD(XonoticSingleplayerDialog, fill, void(entity));
- ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer"))
- ATTRIB(XonoticSingleplayerDialog, tooltip, string, _("Play the singleplayer campaign or instant action matches against bots"))
- ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
- ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80)
- ATTRIB(XonoticSingleplayerDialog, rows, float, 24)
- ATTRIB(XonoticSingleplayerDialog, columns, float, 5)
- ATTRIB(XonoticSingleplayerDialog, campaignBox, entity, NULL)
-ENDCLASS(XonoticSingleplayerDialog)
-#endif
+#include "dialog_singleplayer.qh"
-#ifdef IMPLEMENTATION
+#include <common/mapinfo.qh>
+#include "bigbutton.qh"
+#include "radiobutton.qh"
+#include "textlabel.qh"
+#include "campaign.qh"
void InstantAction_LoadMap(entity btn, entity dummy)
{
e.onClick = CampaignList_LoadMap;
e.onClickEntity = me.campaignBox;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticSingleplayerDialog, XonoticDialog)
+ METHOD(XonoticSingleplayerDialog, fill, void(entity));
+ ATTRIB(XonoticSingleplayerDialog, title, string, _("Singleplayer"))
+ ATTRIB(XonoticSingleplayerDialog, tooltip, string, _("Play the singleplayer campaign or instant action matches against bots"))
+ ATTRIB(XonoticSingleplayerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
+ ATTRIB(XonoticSingleplayerDialog, intendedWidth, float, 0.80)
+ ATTRIB(XonoticSingleplayerDialog, rows, float, 24)
+ ATTRIB(XonoticSingleplayerDialog, columns, float, 5)
+ ATTRIB(XonoticSingleplayerDialog, campaignBox, entity, NULL)
+ENDCLASS(XonoticSingleplayerDialog)
-#ifndef DIALOG_SINGLEPLAYER_WINNER_H
-#define DIALOG_SINGLEPLAYER_WINNER_H
-#include "dialog.qc"
-CLASS(XonoticWinnerDialog, XonoticDialog)
- METHOD(XonoticWinnerDialog, fill, void(entity));
- METHOD(XonoticWinnerDialog, focusEnter, void(entity));
- ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
- ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
- ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
- ATTRIB(XonoticWinnerDialog, rows, float, 12)
- ATTRIB(XonoticWinnerDialog, columns, float, 3)
-ENDCLASS(XonoticWinnerDialog)
-#endif
+#include "dialog_singleplayer_winner.qh"
+
+#include "image.qh"
+#include "button.qh"
-#ifdef IMPLEMENTATION
void XonoticWinnerDialog_fill(entity me)
{
entity e;
{
m_play_click_sound(MENU_SOUND_WINNER);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticWinnerDialog, XonoticDialog)
+ METHOD(XonoticWinnerDialog, fill, void(entity));
+ METHOD(XonoticWinnerDialog, focusEnter, void(entity));
+ ATTRIB(XonoticWinnerDialog, title, string, _("Winner"))
+ ATTRIB(XonoticWinnerDialog, color, vector, SKINCOLOR_DIALOG_SINGLEPLAYER)
+ ATTRIB(XonoticWinnerDialog, intendedWidth, float, 0.32)
+ ATTRIB(XonoticWinnerDialog, rows, float, 12)
+ ATTRIB(XonoticWinnerDialog, columns, float, 3)
+ENDCLASS(XonoticWinnerDialog)
-#ifndef DIALOG_TEAMSELECT_H
-#define DIALOG_TEAMSELECT_H
-#include "rootdialog.qc"
-CLASS(XonoticTeamSelectDialog, XonoticRootDialog)
- METHOD(XonoticTeamSelectDialog, fill, void(entity));
- METHOD(XonoticTeamSelectDialog, showNotify, void(entity));
- ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection"))
- ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
- ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
- ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
- ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
- ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
- ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
- ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
- ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
- ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
- ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, true)
-ENDCLASS(XonoticTeamSelectDialog)
-#endif
+#include "dialog_teamselect.qh"
+
+#include "bigcommandbutton.qh"
-#ifdef IMPLEMENTATION
entity makeTeamButton_T(string theName, vector theColor, string commandtheName, string theTooltip)
{
entity b;
me.TR(me);
me.TD(me, 1, 4, makeXonoticCommandButton(_("spectate"), '0 0 0', "cmd spectate", 1));
}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticTeamSelectDialog, XonoticRootDialog)
+ METHOD(XonoticTeamSelectDialog, fill, void(entity));
+ METHOD(XonoticTeamSelectDialog, showNotify, void(entity));
+ ATTRIB(XonoticTeamSelectDialog, title, string, _("Team Selection"))
+ ATTRIB(XonoticTeamSelectDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticTeamSelectDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticTeamSelectDialog, rows, float, 5)
+ ATTRIB(XonoticTeamSelectDialog, columns, float, 4)
+ ATTRIB(XonoticTeamSelectDialog, name, string, "TeamSelect")
+ ATTRIB(XonoticTeamSelectDialog, team1, entity, NULL)
+ ATTRIB(XonoticTeamSelectDialog, team2, entity, NULL)
+ ATTRIB(XonoticTeamSelectDialog, team3, entity, NULL)
+ ATTRIB(XonoticTeamSelectDialog, team4, entity, NULL)
+ ATTRIB(XonoticTeamSelectDialog, requiresConnection, float, true)
+ENDCLASS(XonoticTeamSelectDialog)
+++ /dev/null
-#ifndef GAMETYPEBUTTON_H
-#define GAMETYPEBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticGametypeButton, RadioButton)
- METHOD(XonoticGametypeButton, configureXonoticGametypeButton, void(entity, float, string, string));
- METHOD(XonoticGametypeButton, setChecked, void(entity, float));
- ATTRIB(XonoticGametypeButton, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticGametypeButton, image, string, SKINGFX_BUTTON_BIG)
- ATTRIB(XonoticGametypeButton, color, vector, SKINCOLOR_BUTTON_N)
- ATTRIB(XonoticGametypeButton, colorC, vector, SKINCOLOR_BUTTON_C)
- ATTRIB(XonoticGametypeButton, colorF, vector, SKINCOLOR_BUTTON_F)
- ATTRIB(XonoticGametypeButton, colorD, vector, SKINCOLOR_BUTTON_D)
- ATTRIB(XonoticGametypeButton, srcMulti, float, 1)
- ATTRIB(XonoticGametypeButton, useDownAsChecked, float, 1)
-
- ATTRIB(XonoticGametypeButton, cvarName, string, string_null)
- METHOD(XonoticGametypeButton, loadCvars, void(entity));
- METHOD(XonoticGametypeButton, saveCvars, void(entity));
-
- ATTRIB(XonoticGametypeButton, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticGametypeButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticGametypeButton)
-entity makeXonoticGametypeButton(float, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
-void GameTypeButton_Click(entity me, entity other);
-entity makeXonoticGametypeButton(float theGroup, string theCvar, string theText)
-{
- entity me;
- me = NEW(XonoticGametypeButton);
- me.configureXonoticGametypeButton(me, theGroup, theCvar, theText, theTooltip);
- return me;
-}
-void XonoticGametypeButton_configureXonoticGametypeButton(entity me, float theGroup, string theCvar, string theText, string theTooltip)
-{
- me.cvarName = (theCvar) ? theCvar : string_null;
- me.loadCvars(me);
- setZonedTooltip(me, theTooltip, theCvar);
- me.configureRadioButton(me, theText, me.fontSize, me.image, theGroup, 0);
- me.align = 0.5;
- me.onClick = GameTypeButton_Click;
- me.onClickEntity = NULL;
-}
-void XonoticGametypeButton_setChecked(entity me, float val)
-{
- if(val != me.checked)
- {
- me.checked = val;
- me.saveCvars(me);
- }
-}
-void XonoticGametypeButton_loadCvars(entity me)
-{
- if (!me.cvarName)
- return;
-
- me.checked = cvar(me.cvarName);
-}
-void XonoticGametypeButton_saveCvars(entity me)
-{
- if (!me.cvarName)
- return;
-
- cvar_set(me.cvarName, ftos(me.checked));
-}
-void GameTypeButton_Click(entity me, entity other)
-{
- RadioButton_Click(me, other);
- me.parent.gameTypeChangeNotify(me.parent);
-}
-#endif
-#ifndef GAMETYPELIST_H
-#define GAMETYPELIST_H
-#include "listbox.qc"
-CLASS(XonoticGametypeList, XonoticListBox)
- METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity));
- ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
- METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticGametypeList, setSelected, void(entity, float));
- METHOD(XonoticGametypeList, loadCvars, void(entity));
- METHOD(XonoticGametypeList, saveCvars, void(entity));
- METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float));
- METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector));
- METHOD(XonoticGametypeList, focusedItemChangeNotify, void(entity));
+#include "gametypelist.qh"
- ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
- ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0)
- ATTRIB(XonoticGametypeList, columnIconSize, float, 0)
- ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0)
- ATTRIB(XonoticGametypeList, columnNameSize, float, 0)
-ENDCLASS(XonoticGametypeList)
-entity makeXonoticGametypeList();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "dialog_multiplayer_create.qh"
+#include <common/mapinfo.qh>
entity makeXonoticGametypeList()
{
void XonoticGametypeList_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
me.itemAbsSize = '0 0 0';
- SUPER(XonoticServerList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
+ SUPER(XonoticGametypeList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
me.realFontSize_y = me.fontSize / (me.itemAbsSize_y = (absSize.y * me.itemHeight));
me.realFontSize_x = me.fontSize / (me.itemAbsSize_x = (absSize.x * (1 - me.controlWidth)));
else
clearTooltip(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticGametypeList, XonoticListBox)
+ METHOD(XonoticGametypeList, configureXonoticGametypeList, void(entity));
+ ATTRIB(XonoticGametypeList, rowsPerItem, float, 2)
+ METHOD(XonoticGametypeList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticGametypeList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticGametypeList, setSelected, void(entity, float));
+ METHOD(XonoticGametypeList, loadCvars, void(entity));
+ METHOD(XonoticGametypeList, saveCvars, void(entity));
+ METHOD(XonoticGametypeList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticGametypeList, clickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticGametypeList, focusedItemChangeNotify, void(entity));
+
+ ATTRIB(XonoticGametypeList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticGametypeList, realUpperMargin, float, 0)
+ ATTRIB(XonoticGametypeList, columnIconOrigin, float, 0)
+ ATTRIB(XonoticGametypeList, columnIconSize, float, 0)
+ ATTRIB(XonoticGametypeList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticGametypeList, columnNameSize, float, 0)
+ENDCLASS(XonoticGametypeList)
+entity makeXonoticGametypeList();
-#ifndef HUDSKINLIST_H
-#define HUDSKINLIST_H
-#include "listbox.qc"
-CLASS(XonoticHUDSkinList, XonoticListBox)
- METHOD(XonoticHUDSkinList, configureXonoticHUDSkinList, void(entity));
- ATTRIB(XonoticHUDSkinList, rowsPerItem, float, 1)
- METHOD(XonoticHUDSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticHUDSkinList, draw, void(entity));
- METHOD(XonoticHUDSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticHUDSkinList, getHUDSkins, void(entity));
- METHOD(XonoticHUDSkinList, setHUDSkin, void(entity));
- METHOD(XonoticHUDSkinList, hudskinName, string(entity, float));
- METHOD(XonoticHUDSkinList, hudskinPath, string(entity, float));
- METHOD(XonoticHUDSkinList, hudskinTitle, string(entity, float));
- METHOD(XonoticHUDSkinList, hudskinAuthor, string(entity, float));
- METHOD(XonoticHUDSkinList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticHUDSkinList, keyDown, float(entity, float, float, float));
- METHOD(XonoticHUDSkinList, destroy, void(entity));
- METHOD(XonoticHUDSkinList, showNotify, void(entity));
+#include "hudskinlist.qh"
- ATTRIB(XonoticHUDSkinList, listHUDSkin, float, -1)
- ATTRIB(XonoticHUDSkinList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticHUDSkinList, columnNameOrigin, float, 0)
- ATTRIB(XonoticHUDSkinList, columnNameSize, float, 0)
- ATTRIB(XonoticHUDSkinList, realUpperMargin, float, 0)
- ATTRIB(XonoticHUDSkinList, origin, vector, '0 0 0')
- ATTRIB(XonoticHUDSkinList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticHUDSkinList, filterString, string, string_null)
- ATTRIB(XonoticHUDSkinList, delayedRefreshTime, float, 0)
- ATTRIB(XonoticHUDSkinList, savedName, string, string_null)
-ENDCLASS(XonoticHUDSkinList)
-
-#ifndef IMPLEMENTATION
-// public:
-entity hudskinlist;
-entity makeXonoticHUDSkinList();
-void SaveHUDSkin_Click(entity btn, entity me);
-void SetHUDSkin_Click(entity btn, entity me);
-#endif
-void HUDSkinList_Refresh_Click(entity btn, entity me);
-void HUDSkinList_Filter_Change(entity box, entity me);
-void HUDSkinList_SavedName_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "inputbox.qh"
entity makeXonoticHUDSkinList()
{
return SUPER(XonoticHUDSkinList).keyDown(me, scan, ascii, shift);
}
}
-#endif
-
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticHUDSkinList, XonoticListBox)
+ METHOD(XonoticHUDSkinList, configureXonoticHUDSkinList, void(entity));
+ ATTRIB(XonoticHUDSkinList, rowsPerItem, float, 1)
+ METHOD(XonoticHUDSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticHUDSkinList, draw, void(entity));
+ METHOD(XonoticHUDSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticHUDSkinList, getHUDSkins, void(entity));
+ METHOD(XonoticHUDSkinList, setHUDSkin, void(entity));
+ METHOD(XonoticHUDSkinList, hudskinName, string(entity, float));
+ METHOD(XonoticHUDSkinList, hudskinPath, string(entity, float));
+ METHOD(XonoticHUDSkinList, hudskinTitle, string(entity, float));
+ METHOD(XonoticHUDSkinList, hudskinAuthor, string(entity, float));
+ METHOD(XonoticHUDSkinList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticHUDSkinList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticHUDSkinList, destroy, void(entity));
+ METHOD(XonoticHUDSkinList, showNotify, void(entity));
+
+ ATTRIB(XonoticHUDSkinList, listHUDSkin, float, -1)
+ ATTRIB(XonoticHUDSkinList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticHUDSkinList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticHUDSkinList, columnNameSize, float, 0)
+ ATTRIB(XonoticHUDSkinList, realUpperMargin, float, 0)
+ ATTRIB(XonoticHUDSkinList, origin, vector, '0 0 0')
+ ATTRIB(XonoticHUDSkinList, itemAbsSize, vector, '0 0 0')
+
+ ATTRIB(XonoticHUDSkinList, filterString, string, string_null)
+ ATTRIB(XonoticHUDSkinList, delayedRefreshTime, float, 0)
+ ATTRIB(XonoticHUDSkinList, savedName, string, string_null)
+ENDCLASS(XonoticHUDSkinList)
+entity hudskinlist;
+entity makeXonoticHUDSkinList();
+void SaveHUDSkin_Click(entity btn, entity me);
+void SetHUDSkin_Click(entity btn, entity me);
+void HUDSkinList_Filter_Change(entity box, entity me);
+void HUDSkinList_Refresh_Click(entity btn, entity me);
+void HUDSkinList_SavedName_Change(entity box, entity me);
-#ifndef IMAGE_H
-#define IMAGE_H
-#include "../item/image.qc"
-CLASS(XonoticImage, Image)
- METHOD(XonoticImage, configureXonoticImage, void(entity, string, float));
-ENDCLASS(XonoticImage)
-entity makeXonoticImage(string theImage, float theAspect);
-#endif
+#include "image.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticImage(string theImage, float theAspect)
{
entity me;
me.configureImage(me, theImage);
me.forcedAspect = theAspect;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/image.qh"
+CLASS(XonoticImage, Image)
+ METHOD(XonoticImage, configureXonoticImage, void(entity, string, float));
+ENDCLASS(XonoticImage)
+entity makeXonoticImage(string theImage, float theAspect);
-#ifndef INPUTBOX_H
-#define INPUTBOX_H
-#include "../item/inputbox.qc"
-CLASS(XonoticInputBox, InputBox)
- METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string, string));
- METHOD(XonoticInputBox, focusLeave, void(entity));
- METHOD(XonoticInputBox, setText, void(entity, string));
- METHOD(XonoticInputBox, keyDown, float(entity, float, float, float));
- ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
- ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
- ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
- ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
- ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
- ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
- ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
- ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
- ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
+#include "inputbox.qh"
- ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
-
- // Clear button attributes
- ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
- ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
- ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
- ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
- ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
-
- ATTRIB(XonoticInputBox, cvarName, string, string_null)
- METHOD(XonoticInputBox, loadCvars, void(entity));
- METHOD(XonoticInputBox, saveCvars, void(entity));
- ATTRIB(XonoticInputBox, sendCvars, float, 0)
-
- ATTRIB(XonoticInputBox, saveImmediately, float, 0)
-ENDCLASS(XonoticInputBox)
-entity makeXonoticInputBox_T(float, string, string theTooltip);
-entity makeXonoticInputBox(float, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticInputBox_T(float doEditColorCodes, string theCvar, string theTooltip)
{
entity me;
r = 1;
return r;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/inputbox.qh"
+CLASS(XonoticInputBox, InputBox)
+ METHOD(XonoticInputBox, configureXonoticInputBox, void(entity, float, string, string));
+ METHOD(XonoticInputBox, focusLeave, void(entity));
+ METHOD(XonoticInputBox, setText, void(entity, string));
+ METHOD(XonoticInputBox, keyDown, float(entity, float, float, float));
+ ATTRIB(XonoticInputBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticInputBox, image, string, SKINGFX_INPUTBOX)
+ ATTRIB(XonoticInputBox, onChange, void(entity, entity), func_null)
+ ATTRIB(XonoticInputBox, onChangeEntity, entity, NULL)
+ ATTRIB(XonoticInputBox, onEnter, void(entity, entity), func_null)
+ ATTRIB(XonoticInputBox, onEnterEntity, entity, NULL)
+ ATTRIB(XonoticInputBox, marginLeft, float, SKINMARGIN_INPUTBOX_CHARS)
+ ATTRIB(XonoticInputBox, marginRight, float, SKINMARGIN_INPUTBOX_CHARS)
+ ATTRIB(XonoticInputBox, color, vector, SKINCOLOR_INPUTBOX_N)
+ ATTRIB(XonoticInputBox, colorF, vector, SKINCOLOR_INPUTBOX_F)
+
+ ATTRIB(XonoticInputBox, alpha, float, SKINALPHA_TEXT)
+
+ // Clear button attributes
+ ATTRIB(XonoticInputBox, cb_offset, float, SKINOFFSET_CLEARBUTTON) // bound to range -1, 0
+ ATTRIB(XonoticInputBox, cb_src, string, SKINGFX_CLEARBUTTON)
+ ATTRIB(XonoticInputBox, cb_color, vector, SKINCOLOR_CLEARBUTTON_N)
+ ATTRIB(XonoticInputBox, cb_colorF, vector, SKINCOLOR_CLEARBUTTON_F)
+ ATTRIB(XonoticInputBox, cb_colorC, vector, SKINCOLOR_CLEARBUTTON_C)
+
+ ATTRIB(XonoticInputBox, cvarName, string, string_null)
+ METHOD(XonoticInputBox, loadCvars, void(entity));
+ METHOD(XonoticInputBox, saveCvars, void(entity));
+ ATTRIB(XonoticInputBox, sendCvars, float, 0)
+
+ ATTRIB(XonoticInputBox, saveImmediately, float, 0)
+ENDCLASS(XonoticInputBox)
+entity makeXonoticInputBox_T(float, string, string theTooltip);
+entity makeXonoticInputBox(float, string);
-#ifndef KEYBINDER_H
-#define KEYBINDER_H
-#include "listbox.qc"
-CLASS(XonoticKeyBinder, XonoticListBox)
- METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity));
- ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
- METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticKeyBinder, showNotify, void(entity));
- METHOD(XonoticKeyBinder, setSelected, void(entity, float));
- METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float));
- METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float));
- METHOD(XonoticKeyBinder, destroy, void(entity));
-
- ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
- ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0)
- ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0)
- ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
- ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
-
- METHOD(XonoticKeyBinder, loadKeyBinds, void(entity));
- ATTRIB(XonoticKeyBinder, previouslySelected, int, -1)
- ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
- ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
- ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
- ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
- ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
- METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string));
-ENDCLASS(XonoticKeyBinder)
-entity makeXonoticKeyBinder();
-void KeyBinder_Bind_Change(entity btn, entity me);
-void KeyBinder_Bind_Clear(entity btn, entity me);
-void KeyBinder_Bind_Edit(entity btn, entity me);
-void KeyBinder_Bind_Reset_All(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "keybinder.qh"
+
+#include <common/weapons/all.qh>
+.int flags;
+
+#include "button.qh"
+#include "dialog_settings_input_userbind.qh"
const string KEY_NOT_BOUND_CMD = "// not bound";
draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0);
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticKeyBinder, XonoticListBox)
+ METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity));
+ ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
+ METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticKeyBinder, showNotify, void(entity));
+ METHOD(XonoticKeyBinder, setSelected, void(entity, float));
+ METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float));
+ METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float));
+ METHOD(XonoticKeyBinder, destroy, void(entity));
+
+ ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0)
+ ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0)
+ ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0)
+ ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
+ ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
+
+ METHOD(XonoticKeyBinder, loadKeyBinds, void(entity));
+ ATTRIB(XonoticKeyBinder, previouslySelected, int, -1)
+ ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
+ ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
+ ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
+ ATTRIB(XonoticKeyBinder, clearButton, entity, NULL)
+ ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL)
+ METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string));
+ENDCLASS(XonoticKeyBinder)
+entity makeXonoticKeyBinder();
+void KeyBinder_Bind_Change(entity btn, entity me);
+void KeyBinder_Bind_Clear(entity btn, entity me);
+void KeyBinder_Bind_Edit(entity btn, entity me);
+void KeyBinder_Bind_Reset_All(entity btn, entity me);
-#ifndef LANGUAGELIST_H
-#define LANGUAGELIST_H
-#include "listbox.qc"
-CLASS(XonoticLanguageList, XonoticListBox)
- METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity));
- ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
- METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticLanguageList, setSelected, void(entity, float));
- METHOD(XonoticLanguageList, loadCvars, void(entity));
- METHOD(XonoticLanguageList, saveCvars, void(entity));
-
- ATTRIB(XonoticLanguageList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticLanguageList, realUpperMargin, float, 0)
- ATTRIB(XonoticLanguageList, columnNameOrigin, float, 0)
- ATTRIB(XonoticLanguageList, columnNameSize, float, 0)
- ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
- ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
-
- METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)); // enter handling
-
- METHOD(XonoticLanguageList, destroy, void(entity));
-
- ATTRIB(XonoticLanguageList, languagelist, float, -1)
- METHOD(XonoticLanguageList, getLanguages, void(entity));
- METHOD(XonoticLanguageList, setLanguage, void(entity));
- METHOD(XonoticLanguageList, languageParameter, string(entity, float, float));
-
- ATTRIB(XonoticLanguageList, name, string, "languageselector") // change this to make it noninteractive (for first run dialog)
-ENDCLASS(XonoticLanguageList)
-
-entity makeXonoticLanguageList();
-void SetLanguage_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "languagelist.qh"
+
+#include "../item/modalcontroller.qh"
+#include "mainwindow.qh"
const float LANGPARM_ID = 0;
const float LANGPARM_NAME = 1;
{
me.setLanguage(me);
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticLanguageList, XonoticListBox)
+ METHOD(XonoticLanguageList, configureXonoticLanguageList, void(entity));
+ ATTRIB(XonoticLanguageList, rowsPerItem, float, 1)
+ METHOD(XonoticLanguageList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticLanguageList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticLanguageList, setSelected, void(entity, float));
+ METHOD(XonoticLanguageList, loadCvars, void(entity));
+ METHOD(XonoticLanguageList, saveCvars, void(entity));
+
+ ATTRIB(XonoticLanguageList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticLanguageList, realUpperMargin, float, 0)
+ ATTRIB(XonoticLanguageList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticLanguageList, columnNameSize, float, 0)
+ ATTRIB(XonoticLanguageList, columnPercentageOrigin, float, 0)
+ ATTRIB(XonoticLanguageList, columnPercentageSize, float, 0)
+
+ METHOD(XonoticLanguageList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticLanguageList, keyDown, float(entity, float, float, float)); // enter handling
+
+ METHOD(XonoticLanguageList, destroy, void(entity));
+
+ ATTRIB(XonoticLanguageList, languagelist, float, -1)
+ METHOD(XonoticLanguageList, getLanguages, void(entity));
+ METHOD(XonoticLanguageList, setLanguage, void(entity));
+ METHOD(XonoticLanguageList, languageParameter, string(entity, float, float));
+
+ ATTRIB(XonoticLanguageList, name, string, "languageselector") // change this to make it noninteractive (for first run dialog)
+ENDCLASS(XonoticLanguageList)
+
+entity makeXonoticLanguageList();
+void SetLanguage_Click(entity btn, entity me);
-#ifndef LISTBOX_H
-#define LISTBOX_H
-#include "../item/listbox.qc"
-CLASS(XonoticListBox, ListBox)
- METHOD(XonoticListBox, configureXonoticListBox, void(entity));
- ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
- ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
- ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
- ATTRIB(XonoticListBox, rowsPerItem, float, 1)
- METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector));
- ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
- ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
- ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
- ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
- ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
- ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
-ENDCLASS(XonoticListBox)
-entity makeXonoticListBox();
-#endif
+#include "listbox.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticListBox()
{
entity me;
me.itemHeight = me.rowsPerItem * me.fontSize / absSize.y;
SUPER(XonoticListBox).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/listbox.qh"
+CLASS(XonoticListBox, ListBox)
+ METHOD(XonoticListBox, configureXonoticListBox, void(entity));
+ ATTRIB(XonoticListBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticListBox, scrollbarWidth, float, SKINWIDTH_SCROLLBAR)
+ ATTRIB(XonoticListBox, src, string, SKINGFX_SCROLLBAR)
+ ATTRIB(XonoticListBox, tolerance, vector, SKINTOLERANCE_SLIDER)
+ ATTRIB(XonoticListBox, rowsPerItem, float, 1)
+ METHOD(XonoticListBox, resizeNotify, void(entity, vector, vector, vector, vector));
+ ATTRIB(XonoticListBox, color, vector, SKINCOLOR_SCROLLBAR_N)
+ ATTRIB(XonoticListBox, colorF, vector, SKINCOLOR_SCROLLBAR_F)
+ ATTRIB(XonoticListBox, color2, vector, SKINCOLOR_SCROLLBAR_S)
+ ATTRIB(XonoticListBox, colorC, vector, SKINCOLOR_SCROLLBAR_C)
+ ATTRIB(XonoticListBox, colorBG, vector, SKINCOLOR_LISTBOX_BACKGROUND)
+ ATTRIB(XonoticListBox, alphaBG, float, SKINALPHA_LISTBOX_BACKGROUND)
+ENDCLASS(XonoticListBox)
+entity makeXonoticListBox();
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-#include "../item/modalcontroller.qc"
-CLASS(MainWindow, ModalController)
- METHOD(MainWindow, configureMainWindow, void(entity));
- METHOD(MainWindow, draw, void(entity));
- ATTRIB(MainWindow, firstRunDialog, entity, NULL)
- ATTRIB(MainWindow, advancedDialog, entity, NULL)
- ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
- ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
- ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
- ATTRIB(MainWindow, winnerDialog, entity, NULL)
- ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
- ATTRIB(MainWindow, cvarsDialog, entity, NULL)
- ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
- ATTRIB(MainWindow, viewDialog, entity, NULL)
- ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
- ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
- ATTRIB(MainWindow, mainNexposee, entity, NULL)
- ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
- ATTRIB(MainWindow, dialogToShow, entity, NULL)
- ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
- ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
- ATTRIB(MainWindow, resetDialog, entity, NULL)
-ENDCLASS(MainWindow)
-#endif
-
-#ifdef IMPLEMENTATION
+#include "mainwindow.qh"
+
+#include "nexposee.qh"
+#include "inputbox.qh"
+#include "dialog_firstrun.qh"
+#include "dialog_hudsetup_exit.qh"
+#include "dialog_hudpanel_notification.qh"
+#include "dialog_hudpanel_ammo.qh"
+#include "dialog_hudpanel_healtharmor.qh"
+#include "dialog_hudpanel_chat.qh"
+#include "dialog_hudpanel_modicons.qh"
+#include "dialog_hudpanel_powerups.qh"
+#include "dialog_hudpanel_pressedkeys.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_hudpanel_engineinfo.qh"
+#include "dialog_hudpanel_infomessages.qh"
+#include "dialog_hudpanel_physics.qh"
+#include "dialog_hudpanel_centerprint.qh"
+#include "dialog_hudpanel_itemstime.qh"
+#include "dialog_hudpanel_quickmenu.qh"
+
+#include "dialog_settings_input_userbind.qh"
+#include "dialog_settings_misc_cvars.qh"
+#include "dialog_settings_misc_reset.qh"
+#include "dialog_settings_user_languagewarning.qh"
+#include "dialog_settings_game_hudconfirm.qh"
+#include "dialog_singleplayer_winner.qh"
+#include "dialog_multiplayer_join_serverinfo.qh"
+#include "dialog_multiplayer_media_demo_startconfirm.qh"
+#include "dialog_multiplayer_media_demo_timeconfirm.qh"
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "dialog_multiplayer_create_mutators.qh"
+#include "dialog_sandboxtools.qh"
+#include "dialog_monstertools.qh"
+#include "dialog_teamselect.qh"
+#include "dialog_singleplayer.qh"
+#include "dialog_multiplayer.qh"
+#include "dialog_settings.qh"
+#include "dialog_credits.qh"
+#include "dialog_quit.qh"
+
void MainWindow_draw(entity me)
{
SUPER(MainWindow).draw(me);
if(cvar_string("_cl_name") == cvar_defstring("_cl_name"))
me.dialogToShow = me.firstRunDialog;
}
-#endif
-
-/* Click. The c-word is here so you can grep for it :-) */
--- /dev/null
+#pragma once
+
+#include <menu/item/modalcontroller.qh>
+
+CLASS(MainWindow, ModalController)
+ METHOD(MainWindow, configureMainWindow, void(entity));
+ METHOD(MainWindow, draw, void(entity));
+ ATTRIB(MainWindow, firstRunDialog, entity, NULL)
+ ATTRIB(MainWindow, advancedDialog, entity, NULL)
+ ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
+ ATTRIB(MainWindow, mapInfoDialog, entity, NULL)
+ ATTRIB(MainWindow, userbindEditDialog, entity, NULL)
+ ATTRIB(MainWindow, winnerDialog, entity, NULL)
+ ATTRIB(MainWindow, serverInfoDialog, entity, NULL)
+ ATTRIB(MainWindow, cvarsDialog, entity, NULL)
+ ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL)
+ ATTRIB(MainWindow, viewDialog, entity, NULL)
+ ATTRIB(MainWindow, hudconfirmDialog, entity, NULL)
+ ATTRIB(MainWindow, languageWarningDialog, entity, NULL)
+ ATTRIB(MainWindow, mainNexposee, entity, NULL)
+ ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
+ ATTRIB(MainWindow, dialogToShow, entity, NULL)
+ ATTRIB(MainWindow, demostartconfirmDialog, entity, NULL)
+ ATTRIB(MainWindow, demotimeconfirmDialog, entity, NULL)
+ ATTRIB(MainWindow, resetDialog, entity, NULL)
+ENDCLASS(MainWindow)
-#ifndef MAPLIST_H
-#define MAPLIST_H
-#include "listbox.qc"
-CLASS(XonoticMapList, XonoticListBox)
- METHOD(XonoticMapList, configureXonoticMapList, void(entity));
- ATTRIB(XonoticMapList, rowsPerItem, float, 4)
- METHOD(XonoticMapList, draw, void(entity));
- METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector));
- METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticMapList, refilter, void(entity));
- METHOD(XonoticMapList, refilterCallback, void(entity, entity));
- METHOD(XonoticMapList, keyDown, float(entity, float, float, float));
-
- ATTRIB(XonoticMapList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticMapList, columnPreviewOrigin, float, 0)
- ATTRIB(XonoticMapList, columnPreviewSize, float, 0)
- ATTRIB(XonoticMapList, columnNameOrigin, float, 0)
- ATTRIB(XonoticMapList, columnNameSize, float, 0)
- ATTRIB(XonoticMapList, checkMarkOrigin, vector, '0 0 0')
- ATTRIB(XonoticMapList, checkMarkSize, vector, '0 0 0')
- ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
- ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
-
- ATTRIB(XonoticMapList, lastGametype, float, 0)
- ATTRIB(XonoticMapList, lastFeatures, float, 0)
-
- ATTRIB(XonoticMapList, origin, vector, '0 0 0')
- ATTRIB(XonoticMapList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticMapList, g_maplistCache, string, string_null)
- METHOD(XonoticMapList, g_maplistCacheToggle, void(entity, float));
- METHOD(XonoticMapList, g_maplistCacheQuery, float(entity, float));
-
- ATTRIB(XonoticMapList, stringFilter, string, string_null)
- ATTRIB(XonoticMapList, stringFilterBox, entity, NULL)
-
- ATTRIB(XonoticMapList, startButton, entity, NULL)
-
- METHOD(XonoticMapList, loadCvars, void(entity));
-
- ATTRIB(XonoticMapList, typeToSearchString, string, string_null)
- ATTRIB(XonoticMapList, typeToSearchTime, float, 0)
-
- METHOD(XonoticMapList, destroy, void(entity));
-
- ATTRIB(XonoticMapList, alphaBG, float, 0)
-ENDCLASS(XonoticMapList)
-entity makeXonoticMapList();
-void MapList_StringFilterBox_Change(entity box, entity me);
-float MapList_StringFilterBox_keyDown(entity me, float key, float ascii, float shift);
-void MapList_Add_Shown(entity btn, entity me);
-void MapList_Remove_Shown(entity btn, entity me);
-void MapList_Add_All(entity btn, entity me);
-void MapList_Remove_All(entity btn, entity me);
-void MapList_LoadMap(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "maplist.qh"
+
+#include <common/mapinfo.qh>
+#include "dialog_multiplayer_create_mapinfo.qh"
+#include "mainwindow.qh"
+#include "inputbox.qh"
+
+.bool disabled;
+
void XonoticMapList_destroy(entity me)
{
MapInfo_Shutdown();
}
return SUPER(XonoticInputBox).keyDown(me, scan, ascii, shift);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticMapList, XonoticListBox)
+ METHOD(XonoticMapList, configureXonoticMapList, void(entity));
+ ATTRIB(XonoticMapList, rowsPerItem, float, 4)
+ METHOD(XonoticMapList, draw, void(entity));
+ METHOD(XonoticMapList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticMapList, clickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticMapList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticMapList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticMapList, refilter, void(entity));
+ METHOD(XonoticMapList, refilterCallback, void(entity, entity));
+ METHOD(XonoticMapList, keyDown, float(entity, float, float, float));
+
+ ATTRIB(XonoticMapList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticMapList, columnPreviewOrigin, float, 0)
+ ATTRIB(XonoticMapList, columnPreviewSize, float, 0)
+ ATTRIB(XonoticMapList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticMapList, columnNameSize, float, 0)
+ ATTRIB(XonoticMapList, checkMarkOrigin, vector, '0 0 0')
+ ATTRIB(XonoticMapList, checkMarkSize, vector, '0 0 0')
+ ATTRIB(XonoticMapList, realUpperMargin1, float, 0)
+ ATTRIB(XonoticMapList, realUpperMargin2, float, 0)
+
+ ATTRIB(XonoticMapList, lastGametype, float, 0)
+ ATTRIB(XonoticMapList, lastFeatures, float, 0)
+
+ ATTRIB(XonoticMapList, origin, vector, '0 0 0')
+ ATTRIB(XonoticMapList, itemAbsSize, vector, '0 0 0')
+
+ ATTRIB(XonoticMapList, g_maplistCache, string, string_null)
+ METHOD(XonoticMapList, g_maplistCacheToggle, void(entity, float));
+ METHOD(XonoticMapList, g_maplistCacheQuery, float(entity, float));
+
+ ATTRIB(XonoticMapList, stringFilter, string, string_null)
+ ATTRIB(XonoticMapList, stringFilterBox, entity, NULL)
+
+ ATTRIB(XonoticMapList, startButton, entity, NULL)
+
+ METHOD(XonoticMapList, loadCvars, void(entity));
+
+ ATTRIB(XonoticMapList, typeToSearchString, string, string_null)
+ ATTRIB(XonoticMapList, typeToSearchTime, float, 0)
+
+ METHOD(XonoticMapList, destroy, void(entity));
+
+ ATTRIB(XonoticMapList, alphaBG, float, 0)
+ENDCLASS(XonoticMapList)
+entity makeXonoticMapList();
+void MapList_StringFilterBox_Change(entity box, entity me);
+float MapList_StringFilterBox_keyDown(entity me, float key, float ascii, float shift);
+void MapList_Add_Shown(entity btn, entity me);
+void MapList_Remove_Shown(entity btn, entity me);
+void MapList_Add_All(entity btn, entity me);
+void MapList_Remove_All(entity btn, entity me);
+void MapList_LoadMap(entity btn, entity me);
-#ifndef NEXPOSEE_H
-#define NEXPOSEE_H
-#include "../item/nexposee.qc"
-CLASS(XonoticNexposee, Nexposee)
- METHOD(XonoticNexposee, configureXonoticNexposee, void(entity));
- METHOD(XonoticNexposee, close, void(entity));
-ENDCLASS(XonoticNexposee)
-entity makeXonoticNexposee();
-#endif
+#include "nexposee.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticNexposee()
{
entity me;
{
m_goto(string_null); // hide
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/nexposee.qh"
+CLASS(XonoticNexposee, Nexposee)
+ METHOD(XonoticNexposee, configureXonoticNexposee, void(entity));
+ METHOD(XonoticNexposee, close, void(entity));
+ENDCLASS(XonoticNexposee)
+entity makeXonoticNexposee();
-#ifndef PICKER_H
-#define PICKER_H
-#include "../item.qc"
-CLASS(XonoticPicker, Item)
- METHOD(XonoticPicker, configureXonoticPicker, void(entity));
- METHOD(XonoticPicker, mousePress, float(entity, vector));
- METHOD(XonoticPicker, mouseRelease, float(entity, vector));
- METHOD(XonoticPicker, mouseMove, float(entity, vector));
- METHOD(XonoticPicker, mouseDrag, float(entity, vector));
- METHOD(XonoticPicker, keyDown, float(entity, float, float, float));
- METHOD(XonoticPicker, draw, void(entity));
- ATTRIB(XonoticPicker, focusable, float, 1)
- ATTRIB(XonoticPicker, disabled, float, 0)
- ATTRIB(XonoticPicker, alpha, float, 1)
- ATTRIB(XonoticPicker, disabledAlpha, float, SKINALPHA_DISABLED)
-
- ATTRIB(XonoticPicker, rows, float, 3)
- ATTRIB(XonoticPicker, columns, float, 2)
-
- METHOD(XonoticPicker, moveFocus, void(entity, vector, vector));
- METHOD(XonoticPicker, cellSelect, void(entity, vector));
- METHOD(XonoticPicker, cellDraw, void(entity, vector, vector));
- METHOD(XonoticPicker, cellIsValid, bool(entity, vector));
- ATTRIB(XonoticPicker, realCellSize, vector, '0 0 0')
- ATTRIB(XonoticPicker, selectedCell, vector, '-1 -1 0')
- ATTRIB(XonoticPicker, focusedCell, vector, '-1 -1 0')
- ATTRIB(XonoticPicker, focusedCellAlpha, float, 0)
- ATTRIB(XonoticPicker, focusedCellTime, float, 0)
- ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
-ENDCLASS(XonoticPicker)
-entity makeXonoticPicker();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "picker.qh"
+
+.bool pressed;
entity makeXonoticPicker()
{
SUPER(XonoticPicker).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item.qh"
+CLASS(XonoticPicker, Item)
+ METHOD(XonoticPicker, configureXonoticPicker, void(entity));
+ METHOD(XonoticPicker, mousePress, float(entity, vector));
+ METHOD(XonoticPicker, mouseRelease, float(entity, vector));
+ METHOD(XonoticPicker, mouseMove, float(entity, vector));
+ METHOD(XonoticPicker, mouseDrag, float(entity, vector));
+ METHOD(XonoticPicker, keyDown, float(entity, float, float, float));
+ METHOD(XonoticPicker, draw, void(entity));
+ ATTRIB(XonoticPicker, focusable, float, 1)
+ ATTRIB(XonoticPicker, disabled, float, 0)
+ ATTRIB(XonoticPicker, alpha, float, 1)
+ ATTRIB(XonoticPicker, disabledAlpha, float, SKINALPHA_DISABLED)
+
+ ATTRIB(XonoticPicker, rows, float, 3)
+ ATTRIB(XonoticPicker, columns, float, 2)
+
+ METHOD(XonoticPicker, moveFocus, void(entity, vector, vector));
+ METHOD(XonoticPicker, cellSelect, void(entity, vector));
+ METHOD(XonoticPicker, cellDraw, void(entity, vector, vector));
+ METHOD(XonoticPicker, cellIsValid, bool(entity, vector));
+ ATTRIB(XonoticPicker, realCellSize, vector, '0 0 0')
+ ATTRIB(XonoticPicker, selectedCell, vector, '-1 -1 0')
+ ATTRIB(XonoticPicker, focusedCell, vector, '-1 -1 0')
+ ATTRIB(XonoticPicker, focusedCellAlpha, float, 0)
+ ATTRIB(XonoticPicker, focusedCellTime, float, 0)
+ ATTRIB(XonoticPicker, pressedCell, vector, '-1 -1 0')
+ENDCLASS(XonoticPicker)
+entity makeXonoticPicker();
-#ifndef PLAYERLIST_H
-#define PLAYERLIST_H
-#include "listbox.qc"
-CLASS(XonoticPlayerList, XonoticListBox)
- ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
- METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, bool));
- ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
- ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
- ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
- ATTRIB(XonoticPlayerList, columnScoreOrigin, float, 0)
- ATTRIB(XonoticPlayerList, columnScoreSize, float, 0)
- ATTRIB(XonoticPlayerList, realUpperMargin, float, 0)
- ATTRIB(XonoticPlayerList, origin, vector, '0 0 0')
- ATTRIB(XonoticPlayerList, itemAbsSize, vector, '0 0 0')
- METHOD(XonoticPlayerList, setPlayerList, void(entity, string));
- METHOD(XonoticPlayerList, getPlayerList, string(entity, float, float));
- ATTRIB(XonoticPlayerList, playerList, float, -1)
- ATTRIB(XonoticPlayerList, selectionDoesntMatter, bool, true)
-ENDCLASS(XonoticPlayerList)
-entity makeXonoticPlayerList();
-#endif
-
-#ifdef IMPLEMENTATION
+#include "playerlist.qh"
+
+.float realUpperMargin2;
const float PLAYERPARM_SCORE = 0;
const float PLAYERPARM_PING = 1;
score = draw_TextShortenToWidth(score, me.columnScoreSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin2 * eY + (me.columnScoreOrigin + 1.00 * (me.columnScoreSize - draw_TextWidth(score, 1, me.realFontSize))) * eX, score, me.realFontSize, rgb, 1, 0);
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticPlayerList, XonoticListBox)
+ ATTRIB(XonoticPlayerList, rowsPerItem, float, 1)
+ METHOD(XonoticPlayerList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticPlayerList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ ATTRIB(XonoticPlayerList, allowFocusSound, float, 0)
+ ATTRIB(XonoticPlayerList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticPlayerList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticPlayerList, columnNameSize, float, 0)
+ ATTRIB(XonoticPlayerList, columnScoreOrigin, float, 0)
+ ATTRIB(XonoticPlayerList, columnScoreSize, float, 0)
+ ATTRIB(XonoticPlayerList, realUpperMargin, float, 0)
+ ATTRIB(XonoticPlayerList, origin, vector, '0 0 0')
+ ATTRIB(XonoticPlayerList, itemAbsSize, vector, '0 0 0')
+ METHOD(XonoticPlayerList, setPlayerList, void(entity, string));
+ METHOD(XonoticPlayerList, getPlayerList, string(entity, float, float));
+ ATTRIB(XonoticPlayerList, playerList, float, -1)
+ ATTRIB(XonoticPlayerList, selectionDoesntMatter, bool, true)
+ENDCLASS(XonoticPlayerList)
+entity makeXonoticPlayerList();
-#ifndef PLAYERMODEL_H
-#define PLAYERMODEL_H
-#include "image.qc"
-CLASS(XonoticPlayerModelSelector, XonoticImage)
- METHOD(XonoticPlayerModelSelector, configureXonoticPlayerModelSelector, void(entity));
- METHOD(XonoticPlayerModelSelector, loadModels, void(entity));
- METHOD(XonoticPlayerModelSelector, loadCvars, void(entity));
- METHOD(XonoticPlayerModelSelector, saveCvars, void(entity));
- METHOD(XonoticPlayerModelSelector, draw, void(entity));
- METHOD(XonoticPlayerModelSelector, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticPlayerModelSelector, showNotify, void(entity));
- ATTRIB(XonoticPlayerModelSelector, currentModel, string, string_null)
- ATTRIB(XonoticPlayerModelSelector, currentSkin, float, 0)
- ATTRIB(XonoticPlayerModelSelector, currentModelImage, string, string_null)
- ATTRIB(XonoticPlayerModelSelector, currentModelTitle, string, string_null)
- ATTRIB(XonoticPlayerModelSelector, currentModelDescription, string, string_null)
- METHOD(XonoticPlayerModelSelector, go, void(entity, float));
- METHOD(XonoticPlayerModelSelector, destroy, void(entity));
- ATTRIB(XonoticPlayerModelSelector, origin, vector, '0 0 0')
- ATTRIB(XonoticPlayerModelSelector, size, vector, '0 0 0')
- ATTRIB(XonoticPlayerModelSelector, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticPlayerModelSelector, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticPlayerModelSelector, titleFontSize, float, SKINFONTSIZE_TITLE)
- ATTRIB(XonoticPlayerModelSelector, bufModels, float, -1)
- ATTRIB(XonoticPlayerModelSelector, numModels, float, -1)
- ATTRIB(XonoticPlayerModelSelector, idxModels, float, -1)
-ENDCLASS(XonoticPlayerModelSelector)
-entity makeXonoticPlayerModelSelector();
-void PlayerModelSelector_Next_Click(entity btn, entity me);
-void PlayerModelSelector_Prev_Click(entity btn, entity me);
-#endif
+#include "playermodel.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticPlayerModelSelector()
{
entity me;
me.destroy(me);
me.loadModels(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "image.qh"
+CLASS(XonoticPlayerModelSelector, XonoticImage)
+ METHOD(XonoticPlayerModelSelector, configureXonoticPlayerModelSelector, void(entity));
+ METHOD(XonoticPlayerModelSelector, loadModels, void(entity));
+ METHOD(XonoticPlayerModelSelector, loadCvars, void(entity));
+ METHOD(XonoticPlayerModelSelector, saveCvars, void(entity));
+ METHOD(XonoticPlayerModelSelector, draw, void(entity));
+ METHOD(XonoticPlayerModelSelector, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticPlayerModelSelector, showNotify, void(entity));
+ ATTRIB(XonoticPlayerModelSelector, currentModel, string, string_null)
+ ATTRIB(XonoticPlayerModelSelector, currentSkin, float, 0)
+ ATTRIB(XonoticPlayerModelSelector, currentModelImage, string, string_null)
+ ATTRIB(XonoticPlayerModelSelector, currentModelTitle, string, string_null)
+ ATTRIB(XonoticPlayerModelSelector, currentModelDescription, string, string_null)
+ METHOD(XonoticPlayerModelSelector, go, void(entity, float));
+ METHOD(XonoticPlayerModelSelector, destroy, void(entity));
+ ATTRIB(XonoticPlayerModelSelector, origin, vector, '0 0 0')
+ ATTRIB(XonoticPlayerModelSelector, size, vector, '0 0 0')
+ ATTRIB(XonoticPlayerModelSelector, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticPlayerModelSelector, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticPlayerModelSelector, titleFontSize, float, SKINFONTSIZE_TITLE)
+ ATTRIB(XonoticPlayerModelSelector, bufModels, float, -1)
+ ATTRIB(XonoticPlayerModelSelector, numModels, float, -1)
+ ATTRIB(XonoticPlayerModelSelector, idxModels, float, -1)
+ENDCLASS(XonoticPlayerModelSelector)
+entity makeXonoticPlayerModelSelector();
+void PlayerModelSelector_Next_Click(entity btn, entity me);
+void PlayerModelSelector_Prev_Click(entity btn, entity me);
-#ifndef PLAYLIST_H
-#define PLAYLIST_H
-#include "listbox.qc"
-CLASS(XonoticPlayList, XonoticListBox)
- METHOD(XonoticPlayList, configureXonoticPlayList, void(entity));
- ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
- METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticPlayList, draw, void(entity));
- METHOD(XonoticPlayList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticPlayList, stopSound, void(entity));
- METHOD(XonoticPlayList, startSound, void(entity, float));
- METHOD(XonoticPlayList, resumeSound, void(entity));
- METHOD(XonoticPlayList, pauseSound, void(entity));
- METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticPlayList, keyDown, float(entity, float, float, float));
- METHOD(XonoticPlayList, mouseDrag, float(entity, vector));
-
- METHOD(XonoticPlayList, addToPlayList, void(entity, string));
- METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity));
- ATTRIB(XonoticPlayList, playingTrack, float, -1)
-
- ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticPlayList, columnNameOrigin, float, 0)
- ATTRIB(XonoticPlayList, columnNameSize, float, 0)
- ATTRIB(XonoticPlayList, columnNumberOrigin, float, 0)
- ATTRIB(XonoticPlayList, columnNumberSize, float, 0)
- ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
- ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
- ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
-ENDCLASS(XonoticPlayList)
-
-entity makeXonoticPlayList();
-void PlayList_Remove(entity btn, entity me);
-void PlayList_Remove_All(entity btn, entity me);
-void StopSound_Click(entity btn, entity me);
-void StartSound_Click(entity btn, entity me);
-void PauseSound_Click(entity btn, entity me);
-void PrevSound_Click(entity btn, entity me);
-void NextSound_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "playlist.qh"
entity makeXonoticPlayList()
{
else
return SUPER(XonoticPlayList).keyDown(me, scan, ascii, shift);
}
-#endif
-
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticPlayList, XonoticListBox)
+ METHOD(XonoticPlayList, configureXonoticPlayList, void(entity));
+ ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
+ METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticPlayList, draw, void(entity));
+ METHOD(XonoticPlayList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticPlayList, stopSound, void(entity));
+ METHOD(XonoticPlayList, startSound, void(entity, float));
+ METHOD(XonoticPlayList, resumeSound, void(entity));
+ METHOD(XonoticPlayList, pauseSound, void(entity));
+ METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticPlayList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticPlayList, mouseDrag, float(entity, vector));
+
+ METHOD(XonoticPlayList, addToPlayList, void(entity, string));
+ METHOD(XonoticPlayList, removeSelectedFromPlayList, void(entity));
+ ATTRIB(XonoticPlayList, playingTrack, float, -1)
+
+ ATTRIB(XonoticPlayList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticPlayList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticPlayList, columnNameSize, float, 0)
+ ATTRIB(XonoticPlayList, columnNumberOrigin, float, 0)
+ ATTRIB(XonoticPlayList, columnNumberSize, float, 0)
+ ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
+ ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
+ ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
+ENDCLASS(XonoticPlayList)
+
+entity makeXonoticPlayList();
+void PlayList_Remove(entity btn, entity me);
+void PlayList_Remove_All(entity btn, entity me);
+void StopSound_Click(entity btn, entity me);
+void StartSound_Click(entity btn, entity me);
+void PauseSound_Click(entity btn, entity me);
+void PrevSound_Click(entity btn, entity me);
+void NextSound_Click(entity btn, entity me);
-#ifndef RADIOBUTTON_H
-#define RADIOBUTTON_H
-#include "../item/radiobutton.qc"
-CLASS(XonoticRadioButton, RadioButton)
- METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string, string));
- METHOD(XonoticRadioButton, draw, void(entity));
- METHOD(XonoticRadioButton, setChecked, void(entity, float));
- ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
- ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
- ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
- ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
- ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
+#include "radiobutton.qh"
- ATTRIB(XonoticRadioButton, cvarName, string, string_null)
- ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
- ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
- ATTRIB(XonoticRadioButton, cvarValueIsAnotherCvar, float, 0)
- METHOD(XonoticRadioButton, loadCvars, void(entity));
- METHOD(XonoticRadioButton, saveCvars, void(entity));
-
- ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticRadioButton)
-entity makeXonoticRadioButton_T(float, string, string, string, string theTooltip);
-entity makeXonoticRadioButton(float, string, string, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticRadioButton_T(float theGroup, string theCvar, string theValue, string theText, string theTooltip)
{
entity me;
}
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/radiobutton.qh"
+CLASS(XonoticRadioButton, RadioButton)
+ METHOD(XonoticRadioButton, configureXonoticRadioButton, void(entity, float, string, string, string, string));
+ METHOD(XonoticRadioButton, draw, void(entity));
+ METHOD(XonoticRadioButton, setChecked, void(entity, float));
+ ATTRIB(XonoticRadioButton, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticRadioButton, image, string, SKINGFX_RADIOBUTTON)
+ ATTRIB(XonoticRadioButton, color, vector, SKINCOLOR_RADIOBUTTON_N)
+ ATTRIB(XonoticRadioButton, colorC, vector, SKINCOLOR_RADIOBUTTON_C)
+ ATTRIB(XonoticRadioButton, colorF, vector, SKINCOLOR_RADIOBUTTON_F)
+ ATTRIB(XonoticRadioButton, colorD, vector, SKINCOLOR_RADIOBUTTON_D)
+
+ ATTRIB(XonoticRadioButton, cvarName, string, string_null)
+ ATTRIB(XonoticRadioButton, cvarValue, string, string_null)
+ ATTRIB(XonoticRadioButton, cvarOffValue, string, string_null)
+ ATTRIB(XonoticRadioButton, cvarValueIsAnotherCvar, float, 0)
+ METHOD(XonoticRadioButton, loadCvars, void(entity));
+ METHOD(XonoticRadioButton, saveCvars, void(entity));
+
+ ATTRIB(XonoticRadioButton, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticRadioButton, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticRadioButton)
+entity makeXonoticRadioButton_T(float, string, string, string, string theTooltip);
+entity makeXonoticRadioButton(float, string, string, string);
-#ifndef ROOTDIALOG_H
-#define ROOTDIALOG_H
-#include "dialog.qc"
-CLASS(XonoticRootDialog, XonoticDialog)
- // still to be customized by user
- /*
- ATTRIB(XonoticDialog, closable, float, 1)
- ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
- ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
- ATTRIB(XonoticDialog, intendedWidth, float, 0)
- ATTRIB(XonoticDialog, rows, float, 3)
- ATTRIB(XonoticDialog, columns, float, 2)
- */
- METHOD(XonoticRootDialog, close, void(entity));
-ENDCLASS(XonoticRootDialog)
-#endif
+#include "rootdialog.qh"
-#ifdef IMPLEMENTATION
void XonoticRootDialog_close(entity me)
{
m_goto(string_null);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "dialog.qh"
+CLASS(XonoticRootDialog, XonoticDialog)
+ // still to be customized by user
+ /*
+ ATTRIB(XonoticDialog, closable, float, 1)
+ ATTRIB(XonoticDialog, title, string, _("Form1")) // ;)
+ ATTRIB(XonoticDialog, color, vector, '1 0.5 1')
+ ATTRIB(XonoticDialog, intendedWidth, float, 0)
+ ATTRIB(XonoticDialog, rows, float, 3)
+ ATTRIB(XonoticDialog, columns, float, 2)
+ */
+ METHOD(XonoticRootDialog, close, void(entity));
+ENDCLASS(XonoticRootDialog)
-#ifndef SCREENSHOTIMAGE_H
-#define SCREENSHOTIMAGE_H
-#include "image.qc"
-CLASS(XonoticScreenshotImage, XonoticImage)
- METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity));
- METHOD(XonoticScreenshotImage, load, void(entity, string));
- METHOD(XonoticScreenshotImage, draw, void(entity));
- ATTRIB(XonoticScreenshotImage, focusable, float, 1) // mousePress and mouseDrag work only if focusable is set
- METHOD(XonoticScreenshotImage, mousePress, float(entity, vector));
- METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector));
- METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector));
- METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector));
- ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
- ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
- ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
-ENDCLASS(XonoticScreenshotImage)
-entity makeXonoticScreenshotImage();
-#endif
+#include "screenshotimage.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticScreenshotImage()
{
entity me;
me.realFontSize_y = me.fontSize / absSize.y;
me.realFontSize_x = me.fontSize / absSize.x;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "image.qh"
+CLASS(XonoticScreenshotImage, XonoticImage)
+ METHOD(XonoticScreenshotImage, configureXonoticScreenshotImage, void(entity));
+ METHOD(XonoticScreenshotImage, load, void(entity, string));
+ METHOD(XonoticScreenshotImage, draw, void(entity));
+ ATTRIB(XonoticScreenshotImage, focusable, float, 1) // mousePress and mouseDrag work only if focusable is set
+ METHOD(XonoticScreenshotImage, mousePress, float(entity, vector));
+ METHOD(XonoticScreenshotImage, mouseDrag, float(entity, vector));
+ METHOD(XonoticScreenshotImage, mouseMove, float(entity, vector));
+ METHOD(XonoticScreenshotImage, resizeNotify, void(entity, vector, vector, vector, vector));
+ ATTRIB(XonoticScreenshotImage, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticScreenshotImage, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticScreenshotImage, showTitle, float, 1)
+ ATTRIB(XonoticScreenshotImage, screenshotTime, float, 0)
+ ATTRIB(XonoticScreenshotImage, screenshotTitle, string, string_null)
+ENDCLASS(XonoticScreenshotImage)
+entity makeXonoticScreenshotImage();
-#ifndef SCREENSHOTLIST_H
-#define SCREENSHOTLIST_H
-#include "listbox.qc"
-CLASS(XonoticScreenshotList, XonoticListBox)
- METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity));
- ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
- METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticScreenshotList, setSelected, void(entity, float));
- METHOD(XonoticScreenshotList, draw, void(entity));
- METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticScreenshotList, getScreenshots, void(entity));
- METHOD(XonoticScreenshotList, previewScreenshot, void(entity));
- METHOD(XonoticScreenshotList, startScreenshot, void(entity));
- METHOD(XonoticScreenshotList, screenshotName, string(entity, float));
- METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float));
- METHOD(XonoticScreenshotList, destroy, void(entity));
- METHOD(XonoticScreenshotList, showNotify, void(entity));
- ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
- ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
- ATTRIB(XonoticScreenshotList, columnNameSize, float, 0)
- ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
- ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
- ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
- ATTRIB(XonoticScreenshotList, filterString, string, string_null)
- ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
- ATTRIB(XonoticScreenshotList, filterTime, float, 0)
-
- ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
- ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
-
- ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
- ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
- ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
- METHOD(XonoticScreenshotList, goScreenshot, void(entity, float));
- METHOD(XonoticScreenshotList, startSlideShow, void(entity));
- METHOD(XonoticScreenshotList, stopSlideShow, void(entity));
-ENDCLASS(XonoticScreenshotList)
-
-entity makeXonoticScreenshotList();
-void StartScreenshot_Click(entity btn, entity me);
-void ScreenshotList_Refresh_Click(entity btn, entity me);
-void ScreenshotList_Filter_Would_Change(entity box, entity me);
-void ScreenshotList_Filter_Change(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "screenshotlist.qh"
+
+#include "dialog_multiplayer_media_screenshot.qh"
+#include "dialog_multiplayer_media_screenshot_viewer.qh"
+#include "inputbox.qh"
+#include "../item/modalcontroller.qh"
entity makeXonoticScreenshotList()
{
}
return SUPER(XonoticScreenshotList).keyDown(me, scan, ascii, shift);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticScreenshotList, XonoticListBox)
+ METHOD(XonoticScreenshotList, configureXonoticScreenshotList, void(entity));
+ ATTRIB(XonoticScreenshotList, rowsPerItem, float, 1)
+ METHOD(XonoticScreenshotList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticScreenshotList, setSelected, void(entity, float));
+ METHOD(XonoticScreenshotList, draw, void(entity));
+ METHOD(XonoticScreenshotList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticScreenshotList, getScreenshots, void(entity));
+ METHOD(XonoticScreenshotList, previewScreenshot, void(entity));
+ METHOD(XonoticScreenshotList, startScreenshot, void(entity));
+ METHOD(XonoticScreenshotList, screenshotName, string(entity, float));
+ METHOD(XonoticScreenshotList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticScreenshotList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticScreenshotList, destroy, void(entity));
+ METHOD(XonoticScreenshotList, showNotify, void(entity));
+ ATTRIB(XonoticScreenshotList, listScreenshot, float, -1)
+ ATTRIB(XonoticScreenshotList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticScreenshotList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticScreenshotList, columnNameSize, float, 0)
+ ATTRIB(XonoticScreenshotList, realUpperMargin, float, 0)
+ ATTRIB(XonoticScreenshotList, origin, vector, '0 0 0')
+ ATTRIB(XonoticScreenshotList, itemAbsSize, vector, '0 0 0')
+ ATTRIB(XonoticScreenshotList, filterString, string, string_null)
+ ATTRIB(XonoticScreenshotList, filterBox, entity, NULL)
+ ATTRIB(XonoticScreenshotList, filterTime, float, 0)
+
+ ATTRIB(XonoticScreenshotList, newScreenshotTime, float, 0)
+ ATTRIB(XonoticScreenshotList, newSlideShowScreenshotTime, float, 0)
+
+ ATTRIB(XonoticScreenshotList, screenshotBrowserDialog, entity, NULL)
+ ATTRIB(XonoticScreenshotList, screenshotPreview, entity, NULL)
+ ATTRIB(XonoticScreenshotList, screenshotViewerDialog, entity, NULL)
+ METHOD(XonoticScreenshotList, goScreenshot, void(entity, float));
+ METHOD(XonoticScreenshotList, startSlideShow, void(entity));
+ METHOD(XonoticScreenshotList, stopSlideShow, void(entity));
+ENDCLASS(XonoticScreenshotList)
+
+entity makeXonoticScreenshotList();
+void StartScreenshot_Click(entity btn, entity me);
+void ScreenshotList_Refresh_Click(entity btn, entity me);
+void ScreenshotList_Filter_Would_Change(entity box, entity me);
+void ScreenshotList_Filter_Change(entity box, entity me);
-#ifndef SERVERLIST_H
-#define SERVERLIST_H
-#include "listbox.qc"
-CLASS(XonoticServerList, XonoticListBox)
- METHOD(XonoticServerList, configureXonoticServerList, void(entity));
- ATTRIB(XonoticServerList, rowsPerItem, float, 1)
- METHOD(XonoticServerList, draw, void(entity));
- METHOD(XonoticServerList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticServerList, keyDown, float(entity, float, float, float));
- METHOD(XonoticServerList, toggleFavorite, void(entity, string));
-
- ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85)
- METHOD(XonoticServerList, mouseMove, float(entity, vector));
- ATTRIB(XonoticServerList, mouseOverIcons, bool, false)
- METHOD(XonoticServerList, focusedItemChangeNotify, void(entity));
-
- ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticServerList, realUpperMargin, float, 0)
- ATTRIB(XonoticServerList, columnIconsOrigin, float, 0)
- ATTRIB(XonoticServerList, columnIconsSize, float, 0)
- ATTRIB(XonoticServerList, columnPingOrigin, float, 0)
- ATTRIB(XonoticServerList, columnPingSize, float, 0)
- ATTRIB(XonoticServerList, columnNameOrigin, float, 0)
- ATTRIB(XonoticServerList, columnNameSize, float, 0)
- ATTRIB(XonoticServerList, columnMapOrigin, float, 0)
- ATTRIB(XonoticServerList, columnMapSize, float, 0)
- ATTRIB(XonoticServerList, columnTypeOrigin, float, 0)
- ATTRIB(XonoticServerList, columnTypeSize, float, 0)
- ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0)
- ATTRIB(XonoticServerList, columnPlayersSize, float, 0)
- ATTRIB(XonoticServerList, lockedSelectedItem, bool, true) // initially keep selected the first item of the list, avoiding an unwanted scrolling
-
- ATTRIB(XonoticServerList, selectedServer, string, string_null) // to restore selected server when needed
- METHOD(XonoticServerList, setSelected, void(entity, float));
- METHOD(XonoticServerList, setSortOrder, void(entity, float, float));
- ATTRIB(XonoticServerList, filterShowEmpty, float, 1)
- ATTRIB(XonoticServerList, filterShowFull, float, 1)
- ATTRIB(XonoticServerList, filterString, string, string_null)
- ATTRIB(XonoticServerList, controlledTextbox, entity, NULL)
- ATTRIB(XonoticServerList, ipAddressBox, entity, NULL)
- ATTRIB(XonoticServerList, favoriteButton, entity, NULL)
- ATTRIB(XonoticServerList, nextRefreshTime, float, 0)
- METHOD(XonoticServerList, refreshServerList, void(entity, float)); // refresh mode: REFRESHSERVERLIST_*
- ATTRIB(XonoticServerList, needsRefresh, float, 1)
- METHOD(XonoticServerList, focusEnter, void(entity));
- METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)));
- ATTRIB(XonoticServerList, sortButton1, entity, NULL)
- ATTRIB(XonoticServerList, sortButton2, entity, NULL)
- ATTRIB(XonoticServerList, sortButton3, entity, NULL)
- ATTRIB(XonoticServerList, sortButton4, entity, NULL)
- ATTRIB(XonoticServerList, sortButton5, entity, NULL)
- ATTRIB(XonoticServerList, connectButton, entity, NULL)
- ATTRIB(XonoticServerList, infoButton, entity, NULL)
- ATTRIB(XonoticServerList, currentSortOrder, float, 0)
- ATTRIB(XonoticServerList, currentSortField, float, -1)
-
- ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
-
- ATTRIB(XonoticServerList, seenIPv4, float, 0)
- ATTRIB(XonoticServerList, seenIPv6, float, 0)
- ATTRIB(XonoticServerList, categoriesHeight, float, 1.25)
-
- METHOD(XonoticServerList, getTotalHeight, float(entity));
- METHOD(XonoticServerList, getItemAtPos, float(entity, float));
- METHOD(XonoticServerList, getItemStart, float(entity, float));
- METHOD(XonoticServerList, getItemHeight, float(entity, float));
-ENDCLASS(XonoticServerList)
-entity makeXonoticServerList();
-
-#ifndef IMPLEMENTATION
-float autocvar_menu_slist_categories;
-float autocvar_menu_slist_categories_onlyifmultiple;
-float autocvar_menu_slist_purethreshold;
-float autocvar_menu_slist_modimpurity;
-float autocvar_menu_slist_recommendations;
-float autocvar_menu_slist_recommendations_maxping;
-float autocvar_menu_slist_recommendations_minfreeslots;
-float autocvar_menu_slist_recommendations_minhumans;
-float autocvar_menu_slist_recommendations_purethreshold;
-
-// server cache fields
-#define SLIST_FIELDS \
- SLIST_FIELD(CNAME, "cname") \
- SLIST_FIELD(PING, "ping") \
- SLIST_FIELD(GAME, "game") \
- SLIST_FIELD(MOD, "mod") \
- SLIST_FIELD(MAP, "map") \
- SLIST_FIELD(NAME, "name") \
- SLIST_FIELD(MAXPLAYERS, "maxplayers") \
- SLIST_FIELD(NUMPLAYERS, "numplayers") \
- SLIST_FIELD(NUMHUMANS, "numhumans") \
- SLIST_FIELD(NUMBOTS, "numbots") \
- SLIST_FIELD(PROTOCOL, "protocol") \
- SLIST_FIELD(FREESLOTS, "freeslots") \
- SLIST_FIELD(PLAYERS, "players") \
- SLIST_FIELD(QCSTATUS, "qcstatus") \
- SLIST_FIELD(CATEGORY, "category") \
- SLIST_FIELD(ISFAVORITE, "isfavorite")
-
-#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
-SLIST_FIELDS
-#undef SLIST_FIELD
-
-const float REFRESHSERVERLIST_RESORT = 0; // sort the server list again to update for changes to e.g. favorite status, categories
-const float REFRESHSERVERLIST_REFILTER = 1; // ..., also update filter and sort criteria
-const float REFRESHSERVERLIST_ASK = 2; // ..., also suggest querying servers now
-const float REFRESHSERVERLIST_RESET = 3; // ..., also clear the list first
-
-// function declarations
-float IsServerInList(string list, string srv);
-#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
-#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
-#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
-
-entity RetrieveCategoryEnt(float catnum);
-
-float CheckCategoryOverride(float cat);
-float CheckCategoryForEntry(float entry);
-float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
-
-void RegisterSLCategories();
-
-void ServerList_Connect_Click(entity btn, entity me);
-void ServerList_Categories_Click(entity box, entity me);
-void ServerList_ShowEmpty_Click(entity box, entity me);
-void ServerList_ShowFull_Click(entity box, entity me);
-void ServerList_Filter_Change(entity box, entity me);
-void ServerList_Favorite_Click(entity btn, entity me);
-void ServerList_Info_Click(entity btn, entity me);
-void ServerList_Update_favoriteButton(entity btn, entity me);
-
-// fields for category entities
-const int MAX_CATEGORIES = 9;
-const int CATEGORY_FIRST = 1;
-entity categories[MAX_CATEGORIES];
-int category_ent_count;
-.string cat_name;
-.string cat_string;
-.string cat_enoverride_string;
-.string cat_dioverride_string;
-.float cat_enoverride;
-.float cat_dioverride;
-
-// fields for drawing categories
-int category_name[MAX_CATEGORIES];
-int category_item[MAX_CATEGORIES];
-int category_draw_count;
-
-#define SLIST_CATEGORIES \
- SLIST_CATEGORY(CAT_FAVORITED, "", "", CTX(_("SLCAT^Favorites"))) \
- SLIST_CATEGORY(CAT_RECOMMENDED, "", "", CTX(_("SLCAT^Recommended"))) \
- SLIST_CATEGORY(CAT_NORMAL, "", "CAT_SERVERS", CTX(_("SLCAT^Normal Servers"))) \
- SLIST_CATEGORY(CAT_SERVERS, "CAT_NORMAL", "CAT_SERVERS", CTX(_("SLCAT^Servers"))) \
- SLIST_CATEGORY(CAT_XPM, "CAT_NORMAL", "CAT_SERVERS", CTX(_("SLCAT^Competitive Mode"))) \
- SLIST_CATEGORY(CAT_MODIFIED, "", "CAT_SERVERS", CTX(_("SLCAT^Modified Servers"))) \
- SLIST_CATEGORY(CAT_OVERKILL, "", "CAT_SERVERS", CTX(_("SLCAT^Overkill Mode"))) \
- SLIST_CATEGORY(CAT_INSTAGIB, "", "CAT_SERVERS", CTX(_("SLCAT^InstaGib Mode"))) \
- SLIST_CATEGORY(CAT_DEFRAG, "", "CAT_SERVERS", CTX(_("SLCAT^Defrag Mode")))
-
-#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
-#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
- int name; \
- string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
-SLIST_CATEGORIES
-#undef SLIST_CATEGORY
+#include "serverlist.qh"
-#endif
-#endif
-#ifdef IMPLEMENTATION
+#include "checkbox.qh"
+#include "inputbox.qh"
+#include "mainwindow.qh"
+#include "dialog_multiplayer_join_serverinfo.qh"
+#include <common/mapinfo.qh>
void RegisterSLCategories()
{
}
return me.itemHeight;
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticServerList, XonoticListBox)
+ METHOD(XonoticServerList, configureXonoticServerList, void(entity));
+ ATTRIB(XonoticServerList, rowsPerItem, float, 1)
+ METHOD(XonoticServerList, draw, void(entity));
+ METHOD(XonoticServerList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticServerList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticServerList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticServerList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticServerList, toggleFavorite, void(entity, string));
+
+ ATTRIB(XonoticServerList, iconsSizeFactor, float, 0.85)
+ METHOD(XonoticServerList, mouseMove, float(entity, vector));
+ ATTRIB(XonoticServerList, mouseOverIcons, bool, false)
+ METHOD(XonoticServerList, focusedItemChangeNotify, void(entity));
+
+ ATTRIB(XonoticServerList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticServerList, realUpperMargin, float, 0)
+ ATTRIB(XonoticServerList, columnIconsOrigin, float, 0)
+ ATTRIB(XonoticServerList, columnIconsSize, float, 0)
+ ATTRIB(XonoticServerList, columnPingOrigin, float, 0)
+ ATTRIB(XonoticServerList, columnPingSize, float, 0)
+ ATTRIB(XonoticServerList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticServerList, columnNameSize, float, 0)
+ ATTRIB(XonoticServerList, columnMapOrigin, float, 0)
+ ATTRIB(XonoticServerList, columnMapSize, float, 0)
+ ATTRIB(XonoticServerList, columnTypeOrigin, float, 0)
+ ATTRIB(XonoticServerList, columnTypeSize, float, 0)
+ ATTRIB(XonoticServerList, columnPlayersOrigin, float, 0)
+ ATTRIB(XonoticServerList, columnPlayersSize, float, 0)
+ ATTRIB(XonoticServerList, lockedSelectedItem, bool, true) // initially keep selected the first item of the list, avoiding an unwanted scrolling
+
+ ATTRIB(XonoticServerList, selectedServer, string, string_null) // to restore selected server when needed
+ METHOD(XonoticServerList, setSelected, void(entity, float));
+ METHOD(XonoticServerList, setSortOrder, void(entity, float, float));
+ ATTRIB(XonoticServerList, filterShowEmpty, float, 1)
+ ATTRIB(XonoticServerList, filterShowFull, float, 1)
+ ATTRIB(XonoticServerList, filterString, string, string_null)
+ ATTRIB(XonoticServerList, controlledTextbox, entity, NULL)
+ ATTRIB(XonoticServerList, ipAddressBox, entity, NULL)
+ ATTRIB(XonoticServerList, favoriteButton, entity, NULL)
+ ATTRIB(XonoticServerList, nextRefreshTime, float, 0)
+ METHOD(XonoticServerList, refreshServerList, void(entity, float)); // refresh mode: REFRESHSERVERLIST_*
+ ATTRIB(XonoticServerList, needsRefresh, float, 1)
+ METHOD(XonoticServerList, focusEnter, void(entity));
+ METHOD(XonoticServerList, positionSortButton, void(entity, entity, float, float, string, void(entity, entity)));
+ ATTRIB(XonoticServerList, sortButton1, entity, NULL)
+ ATTRIB(XonoticServerList, sortButton2, entity, NULL)
+ ATTRIB(XonoticServerList, sortButton3, entity, NULL)
+ ATTRIB(XonoticServerList, sortButton4, entity, NULL)
+ ATTRIB(XonoticServerList, sortButton5, entity, NULL)
+ ATTRIB(XonoticServerList, connectButton, entity, NULL)
+ ATTRIB(XonoticServerList, infoButton, entity, NULL)
+ ATTRIB(XonoticServerList, currentSortOrder, float, 0)
+ ATTRIB(XonoticServerList, currentSortField, float, -1)
+
+ ATTRIB(XonoticServerList, ipAddressBoxFocused, float, -1)
+
+ ATTRIB(XonoticServerList, seenIPv4, float, 0)
+ ATTRIB(XonoticServerList, seenIPv6, float, 0)
+ ATTRIB(XonoticServerList, categoriesHeight, float, 1.25)
+
+ METHOD(XonoticServerList, getTotalHeight, float(entity));
+ METHOD(XonoticServerList, getItemAtPos, float(entity, float));
+ METHOD(XonoticServerList, getItemStart, float(entity, float));
+ METHOD(XonoticServerList, getItemHeight, float(entity, float));
+ENDCLASS(XonoticServerList)
+entity makeXonoticServerList();
+
+void RegisterSLCategories();
+float CheckCategoryForEntry(float entry);
+void ServerList_Filter_Change(entity box, entity me);
+void ServerList_Categories_Click(entity box, entity me);
+void ServerList_ShowEmpty_Click(entity box, entity me);
+void ServerList_ShowFull_Click(entity box, entity me);
+void ServerList_Connect_Click(entity btn, entity me);
+void ServerList_Update_favoriteButton(entity btn, entity me);
+void ServerList_Favorite_Click(entity btn, entity me);
+void ServerList_Info_Click(entity btn, entity me);
+
+// server cache fields
+#define SLIST_FIELDS \
+ SLIST_FIELD(CNAME, "cname") \
+ SLIST_FIELD(PING, "ping") \
+ SLIST_FIELD(GAME, "game") \
+ SLIST_FIELD(MOD, "mod") \
+ SLIST_FIELD(MAP, "map") \
+ SLIST_FIELD(NAME, "name") \
+ SLIST_FIELD(MAXPLAYERS, "maxplayers") \
+ SLIST_FIELD(NUMPLAYERS, "numplayers") \
+ SLIST_FIELD(NUMHUMANS, "numhumans") \
+ SLIST_FIELD(NUMBOTS, "numbots") \
+ SLIST_FIELD(PROTOCOL, "protocol") \
+ SLIST_FIELD(FREESLOTS, "freeslots") \
+ SLIST_FIELD(PLAYERS, "players") \
+ SLIST_FIELD(QCSTATUS, "qcstatus") \
+ SLIST_FIELD(CATEGORY, "category") \
+ SLIST_FIELD(ISFAVORITE, "isfavorite")
+
+#define SLIST_FIELD(suffix,name) float SLIST_FIELD_##suffix;
+SLIST_FIELDS
+#undef SLIST_FIELD
+
+float autocvar_menu_slist_categories;
+float autocvar_menu_slist_categories_onlyifmultiple;
+float autocvar_menu_slist_purethreshold;
+float autocvar_menu_slist_modimpurity;
+float autocvar_menu_slist_recommendations;
+float autocvar_menu_slist_recommendations_maxping;
+float autocvar_menu_slist_recommendations_minfreeslots;
+float autocvar_menu_slist_recommendations_minhumans;
+float autocvar_menu_slist_recommendations_purethreshold;
+
+const float REFRESHSERVERLIST_RESORT = 0; // sort the server list again to update for changes to e.g. favorite status, categories
+const float REFRESHSERVERLIST_REFILTER = 1; // ..., also update filter and sort criteria
+const float REFRESHSERVERLIST_ASK = 2; // ..., also suggest querying servers now
+const float REFRESHSERVERLIST_RESET = 3; // ..., also clear the list first
+
+// function declarations
+float IsServerInList(string list, string srv);
+#define IsFavorite(srv) IsServerInList(cvar_string("net_slist_favorites"), srv)
+#define IsPromoted(srv) IsServerInList(_Nex_ExtResponseSystem_PromotedServers, srv)
+#define IsRecommended(srv) IsServerInList(_Nex_ExtResponseSystem_RecommendedServers, srv)
+
+entity RetrieveCategoryEnt(float catnum);
+
+float CheckCategoryOverride(float cat);
+float m_gethostcachecategory(float entry) { return CheckCategoryOverride(CheckCategoryForEntry(entry)); }
+
+
+// fields for category entities
+const int MAX_CATEGORIES = 9;
+const int CATEGORY_FIRST = 1;
+entity categories[MAX_CATEGORIES];
+int category_ent_count;
+.string cat_name;
+.string cat_string;
+.string cat_enoverride_string;
+.string cat_dioverride_string;
+.float cat_enoverride;
+.float cat_dioverride;
+
+// fields for drawing categories
+int category_name[MAX_CATEGORIES];
+int category_item[MAX_CATEGORIES];
+int category_draw_count;
+
+#define SLIST_CATEGORIES \
+ SLIST_CATEGORY(CAT_FAVORITED, "", "", CTX(_("SLCAT^Favorites"))) \
+ SLIST_CATEGORY(CAT_RECOMMENDED, "", "", CTX(_("SLCAT^Recommended"))) \
+ SLIST_CATEGORY(CAT_NORMAL, "", "CAT_SERVERS", CTX(_("SLCAT^Normal Servers"))) \
+ SLIST_CATEGORY(CAT_SERVERS, "CAT_NORMAL", "CAT_SERVERS", CTX(_("SLCAT^Servers"))) \
+ SLIST_CATEGORY(CAT_XPM, "CAT_NORMAL", "CAT_SERVERS", CTX(_("SLCAT^Competitive Mode"))) \
+ SLIST_CATEGORY(CAT_MODIFIED, "", "CAT_SERVERS", CTX(_("SLCAT^Modified Servers"))) \
+ SLIST_CATEGORY(CAT_OVERKILL, "", "CAT_SERVERS", CTX(_("SLCAT^Overkill Mode"))) \
+ SLIST_CATEGORY(CAT_INSTAGIB, "", "CAT_SERVERS", CTX(_("SLCAT^InstaGib Mode"))) \
+ SLIST_CATEGORY(CAT_DEFRAG, "", "CAT_SERVERS", CTX(_("SLCAT^Defrag Mode")))
+
+#define SLIST_CATEGORY_AUTOCVAR(name) autocvar_menu_slist_categories_##name##_override
+#define SLIST_CATEGORY(name,enoverride,dioverride,str) \
+ int name; \
+ string SLIST_CATEGORY_AUTOCVAR(name) = enoverride;
+SLIST_CATEGORIES
+#undef SLIST_CATEGORY
-#ifndef SKINLIST_H
-#define SKINLIST_H
-#include "listbox.qc"
-CLASS(XonoticSkinList, XonoticListBox)
- METHOD(XonoticSkinList, configureXonoticSkinList, void(entity));
- ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
- METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticSkinList, getSkins, void(entity));
- METHOD(XonoticSkinList, setSkin, void(entity));
- METHOD(XonoticSkinList, loadCvars, void(entity));
- METHOD(XonoticSkinList, saveCvars, void(entity));
- METHOD(XonoticSkinList, skinParameter, string(entity, float, float));
- METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticSkinList, keyDown, float(entity, float, float, float));
- METHOD(XonoticSkinList, destroy, void(entity));
-
- ATTRIB(XonoticSkinList, skinlist, float, -1)
- ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticSkinList, columnPreviewOrigin, float, 0)
- ATTRIB(XonoticSkinList, columnPreviewSize, float, 0)
- ATTRIB(XonoticSkinList, columnNameOrigin, float, 0)
- ATTRIB(XonoticSkinList, columnNameSize, float, 0)
- ATTRIB(XonoticSkinList, realUpperMargin1, float, 0)
- ATTRIB(XonoticSkinList, realUpperMargin2, float, 0)
- ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
- ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticSkinList, name, string, "skinselector")
-ENDCLASS(XonoticSkinList)
-
-entity makeXonoticSkinList();
-void SetSkin_Click(entity btn, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "skinlist.qh"
const float SKINPARM_NAME = 0;
const float SKINPARM_TITLE = 1;
else
return SUPER(XonoticSkinList).keyDown(me, scan, ascii, shift);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticSkinList, XonoticListBox)
+ METHOD(XonoticSkinList, configureXonoticSkinList, void(entity));
+ ATTRIB(XonoticSkinList, rowsPerItem, float, 4)
+ METHOD(XonoticSkinList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticSkinList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticSkinList, getSkins, void(entity));
+ METHOD(XonoticSkinList, setSkin, void(entity));
+ METHOD(XonoticSkinList, loadCvars, void(entity));
+ METHOD(XonoticSkinList, saveCvars, void(entity));
+ METHOD(XonoticSkinList, skinParameter, string(entity, float, float));
+ METHOD(XonoticSkinList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticSkinList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticSkinList, destroy, void(entity));
+
+ ATTRIB(XonoticSkinList, skinlist, float, -1)
+ ATTRIB(XonoticSkinList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticSkinList, columnPreviewOrigin, float, 0)
+ ATTRIB(XonoticSkinList, columnPreviewSize, float, 0)
+ ATTRIB(XonoticSkinList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticSkinList, columnNameSize, float, 0)
+ ATTRIB(XonoticSkinList, realUpperMargin1, float, 0)
+ ATTRIB(XonoticSkinList, realUpperMargin2, float, 0)
+ ATTRIB(XonoticSkinList, origin, vector, '0 0 0')
+ ATTRIB(XonoticSkinList, itemAbsSize, vector, '0 0 0')
+
+ ATTRIB(XonoticSkinList, name, string, "skinselector")
+ENDCLASS(XonoticSkinList)
+
+entity makeXonoticSkinList();
+void SetSkin_Click(entity btn, entity me);
-#ifndef SLIDER_H
-#define SLIDER_H
-#include "../item/slider.qc"
-CLASS(XonoticSlider, Slider)
- METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string, string));
- METHOD(XonoticSlider, setValue, void(entity, float));
- METHOD(XonoticSlider, setValue_noAnim, void(entity, float));
- ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
- ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
- ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
- ATTRIB(XonoticSlider, align, float, 0.5)
- ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
- ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
- ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
- ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
- ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
+#include "slider.qh"
- ATTRIB(XonoticSlider, cvarName, string, string_null)
- METHOD(XonoticSlider, loadCvars, void(entity));
- METHOD(XonoticSlider, saveCvars, void(entity));
- ATTRIB(XonoticSlider, sendCvars, float, 0)
-
- ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticSlider)
-entity makeXonoticSlider_T(float, float, float, string, string theTooltip);
-entity makeXonoticSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
{
entity me;
CheckSendCvars(me, me.cvarName);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/slider.qh"
+CLASS(XonoticSlider, Slider)
+ METHOD(XonoticSlider, configureXonoticSlider, void(entity, float, float, float, string, string));
+ METHOD(XonoticSlider, setValue, void(entity, float));
+ METHOD(XonoticSlider, setValue_noAnim, void(entity, float));
+ ATTRIB(XonoticSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+ ATTRIB(XonoticSlider, image, string, SKINGFX_SLIDER)
+ ATTRIB(XonoticSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
+ ATTRIB(XonoticSlider, align, float, 0.5)
+ ATTRIB(XonoticSlider, color, vector, SKINCOLOR_SLIDER_N)
+ ATTRIB(XonoticSlider, colorC, vector, SKINCOLOR_SLIDER_C)
+ ATTRIB(XonoticSlider, colorF, vector, SKINCOLOR_SLIDER_F)
+ ATTRIB(XonoticSlider, colorD, vector, SKINCOLOR_SLIDER_D)
+ ATTRIB(XonoticSlider, color2, vector, SKINCOLOR_SLIDER_S)
+
+ ATTRIB(XonoticSlider, cvarName, string, string_null)
+ METHOD(XonoticSlider, loadCvars, void(entity));
+ METHOD(XonoticSlider, saveCvars, void(entity));
+ ATTRIB(XonoticSlider, sendCvars, float, 0)
+
+ ATTRIB(XonoticSlider, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticSlider, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticSlider)
+entity makeXonoticSlider_T(float, float, float, string, string theTooltip);
+entity makeXonoticSlider(float, float, float, string);
-#ifndef SLIDER_DECIBELS_H
-#define SLIDER_DECIBELS_H
-#include "slider.qc"
-CLASS(XonoticDecibelsSlider, XonoticSlider)
- METHOD(XonoticDecibelsSlider, loadCvars, void(entity));
- METHOD(XonoticDecibelsSlider, saveCvars, void(entity));
- METHOD(XonoticDecibelsSlider, valueToText, string(entity, float));
-ENDCLASS(XonoticDecibelsSlider)
-entity makeXonoticDecibelsSlider_T(float, float, float, string, string);
-entity makeXonoticDecibelsSlider(float, float, float, string);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "slider_decibels.qh"
float toDecibelOfSquare(float f, float mi)
{
}
SUCCEED();
}
-
-#endif
--- /dev/null
+#pragma once
+
+#include "slider.qh"
+CLASS(XonoticDecibelsSlider, XonoticSlider)
+ METHOD(XonoticDecibelsSlider, loadCvars, void(entity));
+ METHOD(XonoticDecibelsSlider, saveCvars, void(entity));
+ METHOD(XonoticDecibelsSlider, valueToText, string(entity, float));
+ENDCLASS(XonoticDecibelsSlider)
+entity makeXonoticDecibelsSlider_T(float, float, float, string, string);
+entity makeXonoticDecibelsSlider(float, float, float, string);
-#ifndef SLIDER_PARTICLES_H
-#define SLIDER_PARTICLES_H
-#include "textslider.qc"
-CLASS(XonoticParticlesSlider, XonoticTextSlider)
- METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity));
- METHOD(XonoticParticlesSlider, loadCvars, void(entity));
- METHOD(XonoticParticlesSlider, saveCvars, void(entity));
-ENDCLASS(XonoticParticlesSlider)
-entity makeXonoticParticlesSlider();
-#endif
+#include "slider_particles.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticParticlesSlider()
{
entity me;
cvar_set("cl_damageeffect", argv(2));
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticParticlesSlider, XonoticTextSlider)
+ METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity));
+ METHOD(XonoticParticlesSlider, loadCvars, void(entity));
+ METHOD(XonoticParticlesSlider, saveCvars, void(entity));
+ENDCLASS(XonoticParticlesSlider)
+entity makeXonoticParticlesSlider();
-#ifndef SLIDER_PICMIP_H
-#define SLIDER_PICMIP_H
-#include "textslider.qc"
-CLASS(XonoticPicmipSlider, XonoticTextSlider)
- METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity));
- METHOD(XonoticPicmipSlider, draw, void(entity));
- METHOD(XonoticPicmipSlider, autofix, void(entity));
- ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0)
-ENDCLASS(XonoticPicmipSlider)
-entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#endif
+#include "slider_picmip.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticPicmipSlider()
{
entity me;
me.autofix(me);
SUPER(XonoticPicmipSlider).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticPicmipSlider, XonoticTextSlider)
+ METHOD(XonoticPicmipSlider, configureXonoticPicmipSlider, void(entity));
+ METHOD(XonoticPicmipSlider, draw, void(entity));
+ METHOD(XonoticPicmipSlider, autofix, void(entity));
+ ATTRIB(XonoticPicmipSlider, have_s3tc, float, 0)
+ENDCLASS(XonoticPicmipSlider)
+entity makeXonoticPicmipSlider(); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#ifndef SLIDER_RESOLUTION_H
-#define SLIDER_RESOLUTION_H
-#include "textslider.qc"
-CLASS(XonoticResolutionSlider, XonoticTextSlider)
- METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity));
- METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float));
- METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float));
- METHOD(XonoticResolutionSlider, loadCvars, void(entity));
- METHOD(XonoticResolutionSlider, saveCvars, void(entity));
- METHOD(XonoticResolutionSlider, draw, void(entity));
- ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
- ATTRIB(XonoticResolutionSlider, maxAllowedWidth, float, 0)
- ATTRIB(XonoticResolutionSlider, maxAllowedHeight, float, 0)
-ENDCLASS(XonoticResolutionSlider)
-entity makeXonoticResolutionSlider();
-float updateConwidths(float width, float height, float pixelheight);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "slider_resolution.qh"
/* private static */ float XonoticResolutionSlider_DataHasChanged;
}
SUPER(XonoticResolutionSlider).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticResolutionSlider, XonoticTextSlider)
+ METHOD(XonoticResolutionSlider, configureXonoticResolutionSlider, void(entity));
+ METHOD(XonoticResolutionSlider, loadResolutions, void(entity, float));
+ METHOD(XonoticResolutionSlider, addResolution, void(entity, float, float, float));
+ METHOD(XonoticResolutionSlider, loadCvars, void(entity));
+ METHOD(XonoticResolutionSlider, saveCvars, void(entity));
+ METHOD(XonoticResolutionSlider, draw, void(entity));
+ ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
+ ATTRIB(XonoticResolutionSlider, maxAllowedWidth, float, 0)
+ ATTRIB(XonoticResolutionSlider, maxAllowedHeight, float, 0)
+ENDCLASS(XonoticResolutionSlider)
+entity makeXonoticResolutionSlider();
+float updateConwidths(float width, float height, float pixelheight);
-#ifndef SLIDER_SBFADETIME_H
-#define SLIDER_SBFADETIME_H
-#include "textslider.qc"
-CLASS(XonoticScoreboardFadeTimeSlider, XonoticTextSlider)
- METHOD(XonoticScoreboardFadeTimeSlider, configureXonoticScoreboardFadeTimeSlider, void(entity));
- METHOD(XonoticScoreboardFadeTimeSlider, loadCvars, void(entity));
- METHOD(XonoticScoreboardFadeTimeSlider, saveCvars, void(entity));
-ENDCLASS(XonoticScoreboardFadeTimeSlider)
-entity makeXonoticScoreboardFadeTimeSlider();
-#endif
+#include "slider_sbfadetime.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticScoreboardFadeTimeSlider()
{
entity me;
cvar_set("scoreboard_fadeoutspeed", argv(1));
}
}
-#endif
--- /dev/null
+#pragma once
+
+#include "textslider.qh"
+CLASS(XonoticScoreboardFadeTimeSlider, XonoticTextSlider)
+ METHOD(XonoticScoreboardFadeTimeSlider, configureXonoticScoreboardFadeTimeSlider, void(entity));
+ METHOD(XonoticScoreboardFadeTimeSlider, loadCvars, void(entity));
+ METHOD(XonoticScoreboardFadeTimeSlider, saveCvars, void(entity));
+ENDCLASS(XonoticScoreboardFadeTimeSlider)
+entity makeXonoticScoreboardFadeTimeSlider();
-#ifndef SOUNDLIST_H
-#define SOUNDLIST_H
-#include "listbox.qc"
-CLASS(XonoticSoundList, XonoticListBox)
- METHOD(XonoticSoundList, configureXonoticSoundList, void(entity));
- ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
- METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticSoundList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticSoundList, getSounds, void(entity));
- METHOD(XonoticSoundList, soundName, string(entity, int));
- METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, int, vector));
- METHOD(XonoticSoundList, keyDown, float(entity, float, float, float));
- METHOD(XonoticSoundList, destroy, void(entity));
- METHOD(XonoticSoundList, showNotify, void(entity));
-
- ATTRIB(XonoticSoundList, listSound, int, -1)
- ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticSoundList, columnNameOrigin, float, 0)
- ATTRIB(XonoticSoundList, columnNameSize, float, 0)
- ATTRIB(XonoticSoundList, columnNumberOrigin, float, 0)
- ATTRIB(XonoticSoundList, columnNumberSize, float, 0)
- ATTRIB(XonoticSoundList, realUpperMargin, float, 0)
- ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
- ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticSoundList, filterString, string, string_null)
- ATTRIB(XonoticSoundList, playlist, entity, NULL)
-ENDCLASS(XonoticSoundList)
-
-entity makeXonoticSoundList();
-void SoundList_Filter_Change(entity box, entity me);
-void SoundList_Add(entity box, entity me);
-void SoundList_Add_All(entity box, entity me);
-void SoundList_Menu_Track_Change(entity box, entity me);
-void SoundList_Menu_Track_Reset(entity box, entity me);
-#endif
-
-#ifdef IMPLEMENTATION
+#include "soundlist.qh"
+
+#include "inputbox.qh"
+#include "playlist.qh"
entity makeXonoticSoundList()
{
else
return SUPER(XonoticSoundList).keyDown(me, scan, ascii, shift);
}
-#endif
-
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticSoundList, XonoticListBox)
+ METHOD(XonoticSoundList, configureXonoticSoundList, void(entity));
+ ATTRIB(XonoticSoundList, rowsPerItem, float, 1)
+ METHOD(XonoticSoundList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticSoundList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticSoundList, getSounds, void(entity));
+ METHOD(XonoticSoundList, soundName, string(entity, int));
+ METHOD(XonoticSoundList, doubleClickListBoxItem, void(entity, int, vector));
+ METHOD(XonoticSoundList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticSoundList, destroy, void(entity));
+ METHOD(XonoticSoundList, showNotify, void(entity));
+
+ ATTRIB(XonoticSoundList, listSound, int, -1)
+ ATTRIB(XonoticSoundList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticSoundList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticSoundList, columnNameSize, float, 0)
+ ATTRIB(XonoticSoundList, columnNumberOrigin, float, 0)
+ ATTRIB(XonoticSoundList, columnNumberSize, float, 0)
+ ATTRIB(XonoticSoundList, realUpperMargin, float, 0)
+ ATTRIB(XonoticSoundList, origin, vector, '0 0 0')
+ ATTRIB(XonoticSoundList, itemAbsSize, vector, '0 0 0')
+
+ ATTRIB(XonoticSoundList, filterString, string, string_null)
+ ATTRIB(XonoticSoundList, playlist, entity, NULL)
+ENDCLASS(XonoticSoundList)
+
+entity makeXonoticSoundList();
+void SoundList_Filter_Change(entity box, entity me);
+void SoundList_Add(entity box, entity me);
+void SoundList_Add_All(entity box, entity me);
+void SoundList_Menu_Track_Change(entity box, entity me);
+void SoundList_Menu_Track_Reset(entity box, entity me);
+#include "statslist.qh"
#include <common/playerstats.qh>
-#ifndef STATSLIST_H
-#define STATSLIST_H
-#include "listbox.qc"
-CLASS(XonoticStatsList, XonoticListBox)
- METHOD(XonoticStatsList, configureXonoticStatsList, void(entity));
- ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
- METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticStatsList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticStatsList, getStats, void(entity));
- METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector));
- METHOD(XonoticStatsList, keyDown, float(entity, float, float, float));
- METHOD(XonoticStatsList, destroy, void(entity));
- METHOD(XonoticStatsList, showNotify, void(entity));
- ATTRIB(XonoticStatsList, selectionDoesntMatter, bool, true)
-
- ATTRIB(XonoticStatsList, listStats, float, -1)
- ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
- ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
- ATTRIB(XonoticStatsList, columnNameSize, float, 0)
-ENDCLASS(XonoticStatsList)
-
-#ifndef IMPLEMENTATION
-// public:
-entity statslist; // for reference elsewhere
-#endif
-entity makeXonoticStatsList();
-#endif
-
-#ifdef IMPLEMENTATION
-
entity makeXonoticStatsList()
{
entity me;
return SUPER(XonoticStatsList).keyDown(me, scan, ascii, shift);
}
}
-#endif
-
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticStatsList, XonoticListBox)
+ METHOD(XonoticStatsList, configureXonoticStatsList, void(entity));
+ ATTRIB(XonoticStatsList, rowsPerItem, float, 1.4)
+ METHOD(XonoticStatsList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticStatsList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticStatsList, getStats, void(entity));
+ METHOD(XonoticStatsList, doubleClickListBoxItem, void(entity, float, vector));
+ METHOD(XonoticStatsList, keyDown, float(entity, float, float, float));
+ METHOD(XonoticStatsList, destroy, void(entity));
+ METHOD(XonoticStatsList, showNotify, void(entity));
+ ATTRIB(XonoticStatsList, selectionDoesntMatter, bool, true)
+
+ ATTRIB(XonoticStatsList, listStats, float, -1)
+ ATTRIB(XonoticStatsList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticStatsList, realUpperMargin, float, 0)
+ ATTRIB(XonoticStatsList, columnNameOrigin, float, 0)
+ ATTRIB(XonoticStatsList, columnNameSize, float, 0)
+ENDCLASS(XonoticStatsList)
+
+entity statslist; // for reference elsewhere
+entity makeXonoticStatsList();
-#ifndef TAB_H
-#define TAB_H
-#include "../item/tab.qc"
-CLASS(XonoticTab, Tab)
- // still to be customized by user
- /*
- ATTRIB(XonoticTab, intendedWidth, float, 0)
- ATTRIB(XonoticTab, rows, float, 3)
- ATTRIB(XonoticTab, columns, float, 2)
- */
- METHOD(XonoticTab, showNotify, void(entity));
+#include "tab.qh"
- ATTRIB(XonoticTab, marginTop, float, 0) // pixels
- ATTRIB(XonoticTab, marginBottom, float, 0) // pixels
- ATTRIB(XonoticTab, marginLeft, float, 0) // pixels
- ATTRIB(XonoticTab, marginRight, float, 0) // pixels
- ATTRIB(XonoticTab, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
- ATTRIB(XonoticTab, rowSpacing, float, SKINMARGIN_ROWS) // pixels
- ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
-
- ATTRIB(XonoticTab, backgroundImage, string, string_null)
-ENDCLASS(XonoticTab)
-#endif
-
-#ifdef IMPLEMENTATION
void XonoticTab_showNotify(entity me)
{
loadAllCvars(me);
SUPER(XonoticTab).showNotify(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/tab.qh"
+CLASS(XonoticTab, Tab)
+ // still to be customized by user
+ /*
+ ATTRIB(XonoticTab, intendedWidth, float, 0)
+ ATTRIB(XonoticTab, rows, float, 3)
+ ATTRIB(XonoticTab, columns, float, 2)
+ */
+ METHOD(XonoticTab, showNotify, void(entity));
+
+ ATTRIB(XonoticTab, marginTop, float, 0) // pixels
+ ATTRIB(XonoticTab, marginBottom, float, 0) // pixels
+ ATTRIB(XonoticTab, marginLeft, float, 0) // pixels
+ ATTRIB(XonoticTab, marginRight, float, 0) // pixels
+ ATTRIB(XonoticTab, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
+ ATTRIB(XonoticTab, rowSpacing, float, SKINMARGIN_ROWS) // pixels
+ ATTRIB(XonoticTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+
+ ATTRIB(XonoticTab, backgroundImage, string, string_null)
+ENDCLASS(XonoticTab)
-#ifndef TABCONTROLLER_H
-#define TABCONTROLLER_H
-#include "../item/modalcontroller.qc"
-CLASS(XonoticTabController, ModalController)
- METHOD(XonoticTabController, configureXonoticTabController, void(entity, float));
- METHOD(XonoticTabController, makeTabButton_T, entity(entity, string, entity, string));
- METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity));
- ATTRIB(XonoticTabController, rows, float, 0)
- ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
-ENDCLASS(XonoticTabController)
-entity makeXonoticTabController(float theRows);
-#endif
+#include "tabcontroller.qh"
+
+#include "button.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticTabController(float theRows)
{
entity me;
{
return XonoticTabController_makeTabButton_T(me, theTitle, tab, string_null);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/modalcontroller.qh"
+CLASS(XonoticTabController, ModalController)
+ METHOD(XonoticTabController, configureXonoticTabController, void(entity, float));
+ METHOD(XonoticTabController, makeTabButton_T, entity(entity, string, entity, string));
+ METHOD(XonoticTabController, makeTabButton, entity(entity, string, entity));
+ ATTRIB(XonoticTabController, rows, float, 0)
+ ATTRIB(XonoticTabController, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticTabController, image, string, SKINGFX_BUTTON)
+ENDCLASS(XonoticTabController)
+entity makeXonoticTabController(float theRows);
-#ifndef TEXTLABEL_H
-#define TEXTLABEL_H
-#include "../item/label.qc"
-CLASS(XonoticTextLabel, Label)
- METHOD(XonoticTextLabel, configureXonoticTextLabel, void(entity, float, string));
- METHOD(XonoticTextLabel, draw, void(entity));
- ATTRIB(XonoticTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticTextLabel, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticTextLabel, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticTextLabel)
-entity makeXonoticTextLabel(float theAlign, string theText);
-entity makeXonoticHeaderLabel(string theText);
-#endif
+#include "textlabel.qh"
-#ifdef IMPLEMENTATION
entity makeXonoticTextLabel(float theAlign, string theText)
{
entity me;
{
SUPER(XonoticTextLabel).draw(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/label.qh"
+CLASS(XonoticTextLabel, Label)
+ METHOD(XonoticTextLabel, configureXonoticTextLabel, void(entity, float, string));
+ METHOD(XonoticTextLabel, draw, void(entity));
+ ATTRIB(XonoticTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticTextLabel, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticTextLabel, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticTextLabel)
+entity makeXonoticTextLabel(float theAlign, string theText);
+entity makeXonoticHeaderLabel(string theText);
-#ifndef TEXTSLIDER_H
-#define TEXTSLIDER_H
-#include "../item/textslider.qc"
-CLASS(XonoticTextSlider, TextSlider)
- METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string, string));
- METHOD(XonoticTextSlider, setValue, void(entity, float));
- METHOD(XonoticTextSlider, setValue_noAnim, void(entity, float));
- METHOD(XonoticTextSlider, configureXonoticTextSliderValues, void(entity));
- ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
- ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER)
- ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
- ATTRIB(XonoticTextSlider, align, float, 0.5)
- ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N)
- ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C)
- ATTRIB(XonoticTextSlider, colorF, vector, SKINCOLOR_SLIDER_F)
- ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D)
- ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S)
+#include "textslider.qh"
- ATTRIB(XonoticTextSlider, cvarName, string, string_null)
- METHOD(XonoticTextSlider, loadCvars, void(entity));
- METHOD(XonoticTextSlider, saveCvars, void(entity));
- ATTRIB(XonoticTextSlider, sendCvars, float, 0)
-
- ATTRIB(XonoticTextSlider, alpha, float, SKINALPHA_TEXT)
- ATTRIB(XonoticTextSlider, disabledAlpha, float, SKINALPHA_DISABLED)
-ENDCLASS(XonoticTextSlider)
-entity makeXonoticTextSlider_T(string, string theTooltip);
-entity makeXonoticTextSlider(string); // note: you still need to call addValue and configureXonoticTextSliderValues!
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticTextSlider_T(string theCvar, string theTooltip)
{
entity me;
me.configureTextSliderValues(me, string_null);
me.loadCvars(me);
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/textslider.qh"
+CLASS(XonoticTextSlider, TextSlider)
+ METHOD(XonoticTextSlider, configureXonoticTextSlider, void(entity, string, string));
+ METHOD(XonoticTextSlider, setValue, void(entity, float));
+ METHOD(XonoticTextSlider, setValue_noAnim, void(entity, float));
+ METHOD(XonoticTextSlider, configureXonoticTextSliderValues, void(entity));
+ ATTRIB(XonoticTextSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticTextSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+ ATTRIB(XonoticTextSlider, image, string, SKINGFX_SLIDER)
+ ATTRIB(XonoticTextSlider, tolerance, vector, SKINTOLERANCE_SLIDER)
+ ATTRIB(XonoticTextSlider, align, float, 0.5)
+ ATTRIB(XonoticTextSlider, color, vector, SKINCOLOR_SLIDER_N)
+ ATTRIB(XonoticTextSlider, colorC, vector, SKINCOLOR_SLIDER_C)
+ ATTRIB(XonoticTextSlider, colorF, vector, SKINCOLOR_SLIDER_F)
+ ATTRIB(XonoticTextSlider, colorD, vector, SKINCOLOR_SLIDER_D)
+ ATTRIB(XonoticTextSlider, color2, vector, SKINCOLOR_SLIDER_S)
+
+ ATTRIB(XonoticTextSlider, cvarName, string, string_null)
+ METHOD(XonoticTextSlider, loadCvars, void(entity));
+ METHOD(XonoticTextSlider, saveCvars, void(entity));
+ ATTRIB(XonoticTextSlider, sendCvars, float, 0)
+
+ ATTRIB(XonoticTextSlider, alpha, float, SKINALPHA_TEXT)
+ ATTRIB(XonoticTextSlider, disabledAlpha, float, SKINALPHA_DISABLED)
+ENDCLASS(XonoticTextSlider)
+entity makeXonoticTextSlider_T(string, string theTooltip);
+entity makeXonoticTextSlider(string); // note: you still need to call addValue and configureXonoticTextSliderValues!
#include "util.qh"
-#include "../item.qc"
+#include "../item.qh"
#include "../menu.qh"
#include <common/campaign_common.qh>
-#ifndef MENU_UTIL_H
-#define MENU_UTIL_H
+#pragma once
float GL_CheckExtension(string ext);
float GL_Have_TextureCompression();
float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;
void CheckSendCvars(entity me, string cvarnamestring);
-#endif
-#ifndef WEAPONARENACHECKBOX_H
-#define WEAPONARENACHECKBOX_H
-#include "../item/checkbox.qc"
-CLASS(XonoticWeaponarenaCheckBox, CheckBox)
- METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string));
- METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float));
- ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
- ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
- ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
+#include "weaponarenacheckbox.qh"
- METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity));
- METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity));
-ENDCLASS(XonoticWeaponarenaCheckBox)
-entity makeXonoticWeaponarenaCheckBox(string, string);
-#endif
-
-#ifdef IMPLEMENTATION
entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
{
entity me;
localcmd(strcat("\nmenu_cmd removefromlist menu_weaponarena ", me.netname, "\n"));
localcmd("\ng_weaponarena \"$menu_weaponarena\"\n");
}
-#endif
--- /dev/null
+#pragma once
+
+#include "../item/checkbox.qh"
+CLASS(XonoticWeaponarenaCheckBox, CheckBox)
+ METHOD(XonoticWeaponarenaCheckBox, configureXonoticWeaponarenaCheckBox, void(entity, string, string));
+ METHOD(XonoticWeaponarenaCheckBox, setChecked, void(entity, float));
+ ATTRIB(XonoticWeaponarenaCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(XonoticWeaponarenaCheckBox, image, string, SKINGFX_CHECKBOX)
+ ATTRIB(XonoticWeaponarenaCheckBox, netname, string, string_null)
+
+ METHOD(XonoticWeaponarenaCheckBox, loadCvars, void(entity));
+ METHOD(XonoticWeaponarenaCheckBox, saveCvars, void(entity));
+ENDCLASS(XonoticWeaponarenaCheckBox)
+entity makeXonoticWeaponarenaCheckBox(string, string);
-#ifndef WEAPONSLIST_H
-#define WEAPONSLIST_H
-#include "listbox.qc"
-CLASS(XonoticWeaponsList, XonoticListBox)
- METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity));
- METHOD(XonoticWeaponsList, toString, string(entity));
- ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
- METHOD(XonoticWeaponsList, draw, void(entity));
- METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, bool));
- METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector));
- METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float));
- ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
- ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0)
- METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector));
+#include "weaponslist.qh"
- ATTRIB(XonoticWeaponsList, applyButton, entity, NULL)
-ENDCLASS(XonoticWeaponsList)
-entity makeXonoticWeaponsList();
-void WeaponsList_MoveUp_Click(entity btn, entity me);
-void WeaponsList_MoveDown_Click(entity box, entity me);
-#endif
+#include <common/weapons/all.qh>
+
+.bool disabled;
-#ifdef IMPLEMENTATION
entity makeXonoticWeaponsList()
{
entity me;
return 1;
return 0;
}
-#endif
--- /dev/null
+#pragma once
+
+#include "listbox.qh"
+CLASS(XonoticWeaponsList, XonoticListBox)
+ METHOD(XonoticWeaponsList, configureXonoticWeaponsList, void(entity));
+ METHOD(XonoticWeaponsList, toString, string(entity));
+ ATTRIB(XonoticWeaponsList, rowsPerItem, float, 1)
+ METHOD(XonoticWeaponsList, draw, void(entity));
+ METHOD(XonoticWeaponsList, drawListBoxItem, void(entity, int, vector, bool, bool));
+ METHOD(XonoticWeaponsList, resizeNotify, void(entity, vector, vector, vector, vector));
+ METHOD(XonoticWeaponsList, keyDown, float(entity, float, float, float));
+ ATTRIB(XonoticWeaponsList, realFontSize, vector, '0 0 0')
+ ATTRIB(XonoticWeaponsList, realUpperMargin, float, 0)
+ METHOD(XonoticWeaponsList, mouseDrag, float(entity, vector));
+
+ ATTRIB(XonoticWeaponsList, applyButton, entity, NULL)
+ENDCLASS(XonoticWeaponsList)
+entity makeXonoticWeaponsList();
+void WeaponsList_MoveUp_Click(entity btn, entity me);
+void WeaponsList_MoveDown_Click(entity box, entity me);
+++ /dev/null
-#!/bin/sh
-set -eu
-
-MODE=$1
-IN=$3
-OUT=$2
-
-QCC=${QCC}
-QCCIDENT="-DGMQCC"
-
-case ${MODE} in
- client) PROG=CSQC
- ;;
- menu) PROG=MENUQC
- ;;
- server) PROG=SVQC
- ;;
-esac
-
-CPP="${CPP} -I. ${QCCIDENT} ${QCCDEFS} -D${PROG}"
-${CPP} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror -o ../.tmp/${MODE}.txt ${IN}
-${CPP} -dM 1>../.tmp/${MODE}_macros.txt -H 2>../.tmp/${MODE}_includes.txt ${IN}
-sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' ../.tmp/${MODE}.txt > ../.tmp/${MODE}.qc
-cd ${MODE}
-echo $(basename ${QCC}) ${QCCFLAGS} -o ${OUT} ${MODE}.qc
-${QCC} ${QCCFLAGS} -o ${OUT} ../../.tmp/${MODE}.qc
-#ifndef SERVER_ALL_H
-#define SERVER_ALL_H
+#pragma once
int maxclients;
#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
#define IS_MONSTER(v) (v.flags & FL_MONSTER)
#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
for(int _i = 1; _i <= maxclients; ++_i) \
{ \
const noref int i = _i; \
- const noref entity it = ftoe(i); \
+ ITER_CONST noref entity it = ftoe(i); \
if(cond) { LAMBDA(body) } \
} \
} MACRO_END
#include "constants.qh"
#include "defs.qh"
#include "miscfunctions.qh"
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "anticheat.qc"
+#include "antilag.qc"
+#include "campaign.qc"
+#include "cheats.qc"
+#include "cl_client.qc"
+#include "cl_impulse.qc"
+#include "cl_player.qc"
+#include "g_damage.qc"
+#include "g_hook.qc"
+#include "g_lights.qc"
+#include "g_models.qc"
+#include "g_subs.qc"
+#include "g_world.qc"
+#include "ipban.qc"
+#include "item_key.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "playerdemo.qc"
+#include "portals.qc"
+#include "race.qc"
+#include "round_handler.qc"
+#include "scores.qc"
+#include "scores_rules.qc"
+#include "spawnpoints.qc"
+#include "steerlib.qc"
+#include "sv_main.qc"
+#include "teamplay.qc"
+#include "tests.qc"
+#include "t_halflife.qc"
+#include "t_quake.qc"
+#include "t_quake3.qc"
}
}
-void anticheat_spectatecopy(entity spectatee)
-{SELFPARAM();
+void anticheat_spectatecopy(entity this, entity spectatee)
+{
// div0_evade -> SPECTATORS
- self.angles = CS(spectatee).anticheat_div0_evade_v_angle;
+ this.angles = CS(spectatee).anticheat_div0_evade_v_angle;
}
-void anticheat_prethink()
+void anticheat_prethink(entity this)
{
- SELFPARAM();
// div0_evade -> SPECTATORS
CS(this).anticheat_div0_evade_offset = 0;
}
return strcat(s, ":-");
}
-void anticheat_report()
-{SELFPARAM();
+void anticheat_report(entity this)
+{
if(!autocvar_sv_eventlog)
return;
// TODO(divVerent): Use xonstat to acquire good thresholds.
- GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - CS(self).anticheat_jointime)));
- GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack), 240, 0, 9999))); // Actually this one seems broken.
- GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m1), 240, 1.01, 1.25)));
- GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m2), 240, 1.01, 1.25)));
- GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m3), 240, 1.01, 1.25)));
- GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m4), 240, 1.01, 1.25)));
- GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_speedhack_m5), 240, 1.01, 1.25)));
- GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_old), 120, 0.15, 0.4)));
- GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_new), 120, 0.25, 0.8)));
- GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_div0_evade), 120, 0.2, 0.5)));
- GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m2), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m3), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m4), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m7), 120, 0, 9999)));
- GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m10), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:_time:", ftos(this.playerid), ":", ftos(servertime - CS(this).anticheat_jointime)));
+ GameLogEcho(strcat(":anticheat:speedhack:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack), 240, 0, 9999))); // Actually this one seems broken.
+ GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m1), 240, 1.01, 1.25)));
+ GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m2), 240, 1.01, 1.25)));
+ GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m3), 240, 1.01, 1.25)));
+ GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m4), 240, 1.01, 1.25)));
+ GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m5), 240, 1.01, 1.25)));
+ GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old), 120, 0.15, 0.4)));
+ GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new), 120, 0.25, 0.8)));
+ GameLogEcho(strcat(":anticheat:div0_evade:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_evade), 120, 0.2, 0.5)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7), 120, 0, 9999)));
+ GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10), 120, 0, 9999)));
}
-float anticheat_getvalue(string id)
-{SELFPARAM();
+float anticheat_getvalue(entity this, string id)
+{
switch(id) {
- case "_time": return servertime - CS(self).anticheat_jointime;
- case "speedhack": return MEAN_EVALUATE(CS(self), anticheat_speedhack);
- case "speedhack_m1": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m1);
- case "speedhack_m2": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m2);
- case "speedhack_m3": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m3);
- case "speedhack_m4": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m4);
- case "speedhack_m5": return MEAN_EVALUATE(CS(self), anticheat_speedhack_m5);
- case "div0_strafebot_old": return MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_old);
- case "div0_strafebot_new": return MEAN_EVALUATE(CS(self), anticheat_div0_strafebot_new);
- case "div0_evade": return MEAN_EVALUATE(CS(self), anticheat_div0_evade);
- case "idle_snapaim": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise);
- case "idle_snapaim_signal": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_signal);
- case "idle_snapaim_noise": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_noise);
- case "idle_snapaim_m2": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m2);
- case "idle_snapaim_m3": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m3);
- case "idle_snapaim_m4": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m4);
- case "idle_snapaim_m7": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m7);
- case "idle_snapaim_m10": return MEAN_EVALUATE(CS(self), anticheat_idle_snapaim_m10);
+ case "_time": return servertime - CS(this).anticheat_jointime;
+ case "speedhack": return MEAN_EVALUATE(CS(this), anticheat_speedhack);
+ case "speedhack_m1": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m1);
+ case "speedhack_m2": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m2);
+ case "speedhack_m3": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m3);
+ case "speedhack_m4": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m4);
+ case "speedhack_m5": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m5);
+ case "div0_strafebot_old": return MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old);
+ case "div0_strafebot_new": return MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new);
+ case "div0_evade": return MEAN_EVALUATE(CS(this), anticheat_div0_evade);
+ case "idle_snapaim": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise);
+ case "idle_snapaim_signal": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal);
+ case "idle_snapaim_noise": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise);
+ case "idle_snapaim_m2": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2);
+ case "idle_snapaim_m3": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3);
+ case "idle_snapaim_m4": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4);
+ case "idle_snapaim_m7": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7);
+ case "idle_snapaim_m10": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10);
}
return -1;
}
}
void anticheat_endframe()
-{SELFPARAM();
+{
FOREACH_CLIENT(it.fixangle, anticheat_fixangle(it));
anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
}
-#ifndef ANTICHEAT_H
-#define ANTICHEAT_H
+#pragma once
void anticheat_init(entity this);
-void anticheat_report();
+void anticheat_report(entity this);
void anticheat_physics(entity this);
-void anticheat_spectatecopy(entity spectatee);
-void anticheat_prethink();
+void anticheat_spectatecopy(entity this, entity spectatee);
+void anticheat_prethink(entity this);
-float anticheat_getvalue(string name);
+float anticheat_getvalue(entity this, string name);
void anticheat_startframe();
void anticheat_endframe();
void anticheat_fixangle(entity this);
-#endif
+#include "antilag.qh"
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
.float antilag_debug;
-void antilag_record(entity e, float t)
+void antilag_record(entity e, entity store, float t)
{
- if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
- return;
-
- if(e.vehicle)
- antilag_record(e.vehicle, t);
-
- if(time < CS(e).antilag_times[CS(e).antilag_index])
- return;
- CS(e).antilag_index += 1;
- if(CS(e).antilag_index >= ANTILAG_MAX_ORIGINS)
- CS(e).antilag_index = 0;
- CS(e).antilag_times[CS(e).antilag_index] = t;
- CS(e).antilag_origins[CS(e).antilag_index] = e.origin;
-
- if(CS(e).antilag_debug)
- te_spark(antilag_takebackorigin(e, t - CS(e).antilag_debug), '0 0 0', 32);
-
+ if (e.vehicle) {
+ if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
+ antilag_record(e.vehicle, e.vehicle, t);
+ }
+
+ if (time < store.antilag_times[store.antilag_index]) return;
+ store.antilag_index += 1;
+ if (store.antilag_index >= ANTILAG_MAX_ORIGINS)
+ store.antilag_index = 0;
+ store.antilag_times[store.antilag_index] = t;
+ store.antilag_origins[store.antilag_index] = e.origin;
+
+ if (store.antilag_debug)
+ te_spark(antilag_takebackorigin(e, store, t - store.antilag_debug), '0 0 0', 32);
}
// finds the index BEFORE t
-float antilag_find(entity e, float t)
+float antilag_find(entity e, entity store, float t)
{
- for(int i = CS(e).antilag_index; i > 0; --i)
- if(CS(e).antilag_times[i] >= t)
- if(CS(e).antilag_times[i - 1] < t)
+ for(int i = store.antilag_index; i > 0; --i)
+ if(store.antilag_times[i] >= t)
+ if(store.antilag_times[i - 1] < t)
return i - 1;
- if(CS(e).antilag_times[0] >= t)
- if(CS(e).antilag_times[ANTILAG_MAX_ORIGINS - 1] < t)
+ if(store.antilag_times[0] >= t)
+ if(store.antilag_times[ANTILAG_MAX_ORIGINS - 1] < t)
return ANTILAG_MAX_ORIGINS - 1;
- for(int i = ANTILAG_MAX_ORIGINS - 1; i > CS(e).antilag_index + 1; --i)
- if(CS(e).antilag_times[i] >= t)
- if(CS(e).antilag_times[i - 1] < t)
+ for(int i = ANTILAG_MAX_ORIGINS - 1; i > store.antilag_index + 1; --i)
+ if(store.antilag_times[i] >= t)
+ if(store.antilag_times[i - 1] < t)
return i - 1;
// if we get here, t is sandwiched nowhere, so let's assume it's in the present
return -1;
}
-vector antilag_takebackorigin(entity e, float t)
+vector antilag_takebackorigin(entity e, entity store, float t)
{
- int i0 = antilag_find(e, t);
+ int i0 = antilag_find(e, store, t);
if (i0 < 0)
{
// IN THE PRESENT
- if(CS(e).antilag_takenback)
- return CS(e).antilag_saved_origin;
+ if(store.antilag_takenback)
+ return store.antilag_saved_origin;
else
return e.origin;
}
if (i1 >= ANTILAG_MAX_ORIGINS)
i1 = 0;
- return lerpv(CS(e).antilag_times[i0], CS(e).antilag_origins[i0], CS(e).antilag_times[i1], CS(e).antilag_origins[i1], t);
+ return lerpv(store.antilag_times[i0], store.antilag_origins[i0], store.antilag_times[i1], store.antilag_origins[i1], t);
}
-vector antilag_takebackavgvelocity(entity e, float t0, float t1)
+vector antilag_takebackavgvelocity(entity e, entity store, float t0, float t1)
{
- vector o0, o1;
-
- if(t0 >= t1)
- return '0 0 0';
- o0 = antilag_takebackorigin(e, t0);
- o1 = antilag_takebackorigin(e, t1);
+ if (t0 >= t1) return '0 0 0';
+ vector o0 = antilag_takebackorigin(e, store, t0);
+ vector o1 = antilag_takebackorigin(e, store, t1);
return (o1 - o0) * (1 / (t1 - t0));
}
-void antilag_takeback(entity e, float t)
+void antilag_takeback(entity e, entity store, float t)
{
+ if (e.vehicle) {
+ if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
+ antilag_takeback(e.vehicle, e.vehicle, t);
+ }
- if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
- return;
+ if (!store.antilag_takenback)
+ store.antilag_saved_origin = e.origin;
- if(e.vehicle)
- antilag_takeback(e.vehicle, t);
-
- if(!CS(e).antilag_takenback)
- CS(e).antilag_saved_origin = e.origin;
-
- vector org = antilag_takebackorigin(e, t);
+ vector org = antilag_takebackorigin(e, store, t);
setorigin(e, org);
- CS(e).antilag_takenback = true;
+ store.antilag_takenback = true;
}
-void antilag_restore(entity e)
+void antilag_restore(entity e, entity store)
{
- if (e.vehicle && e.vehicle.vehicle_flags == VHF_PLAYERSLOT)
- return;
-
- if(e.vehicle)
- antilag_restore(e.vehicle);
+ if (e.vehicle) {
+ if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
+ antilag_restore(e.vehicle, e.vehicle);
+ }
- if(!CS(e).antilag_takenback)
- return;
+ if (!store.antilag_takenback) return;
- setorigin(e, CS(e).antilag_saved_origin);
- CS(e).antilag_takenback = false;
+ setorigin(e, store.antilag_saved_origin);
+ store.antilag_takenback = false;
}
-void antilag_clear(entity e)
+void antilag_clear(entity e, entity store)
{
- antilag_restore(e);
- for (int i = 0; i < ANTILAG_MAX_ORIGINS; ++i)
- {
- CS(e).antilag_times[i] = -2342;
- CS(e).antilag_origins[i] = e.origin;
+ antilag_restore(e, store);
+ for (int i = 0; i < ANTILAG_MAX_ORIGINS; ++i) {
+ store.antilag_times[i] = -2342;
+ store.antilag_origins[i] = e.origin;
}
- CS(e).antilag_index = ANTILAG_MAX_ORIGINS - 1; // next one is 0
+ store.antilag_index = ANTILAG_MAX_ORIGINS - 1; // next one is 0
}
-#ifndef ANTILAG_H
-#define ANTILAG_H
+#pragma once
-void antilag_record(entity e, float t);
-vector antilag_takebackorigin(entity e, float t);
-vector antilag_takebackavgvelocity(entity e, float t0, float t1);
-void antilag_takeback(entity e, float t);
-void antilag_restore(entity e);
-void antilag_clear(entity e);
+void antilag_record(entity e, entity store, float t);
+vector antilag_takebackorigin(entity e, entity store, float t);
+void antilag_takeback(entity e, entity store, float t);
+void antilag_restore(entity e, entity store);
+void antilag_clear(entity e, entity store);
.float antilag_debug;
#define ANTILAG_LATENCY(e) min(0.4, e.ping * 0.001)
// add one ticrate?
-#endif
-#ifndef SERVER_AUTOCVARS_H
-#define SERVER_AUTOCVARS_H
+#pragma once
bool autocvar__notarget;
bool autocvar__campaign_testrun;
float autocvar_g_spawn_furthest;
bool autocvar_g_spawn_useallspawns;
bool autocvar_g_spawnpoints_auto_move_out_of_solid;
-#define autocvar_g_spawnshieldtime cvar("g_spawnshieldtime")
+float autocvar_g_spawnshieldtime;
float autocvar_g_spawnshield_blockdamage;
float autocvar_g_teamdamage_resetspeed;
float autocvar_g_teamdamage_threshold;
int autocvar_g_frozen_revive_falldamage_health;
bool autocvar_g_frozen_damage_trigger;
float autocvar_g_frozen_force;
-#endif
+++ /dev/null
-#include "aim.qc"
-#include "bot.qc"
-#include "navigation.qc"
-#include "scripting.qc"
-#include "waypoints.qc"
-
-#include "havocbot/_all.inc"
--- /dev/null
+// generated file; do not modify
+#include "aim.qc"
+#include "bot.qc"
+#include "navigation.qc"
+#include "scripting.qc"
+#include "waypoints.qc"
#include "bot.qh"
+#include <common/physics/player.qh>
+#include <common/state.qh>
+
#include "../weapons/weaponsystem.qh"
#include "../mutators/all.qh"
return false;
}
-void lag_update()
-{SELFPARAM();
- if (self.lag1_time) if (time > self.lag1_time) {self.lag_func(self.lag1_time, self.lag1_float1, self.lag1_float2, self.lag1_entity1, self.lag1_vec1, self.lag1_vec2, self.lag1_vec3, self.lag1_vec4);self.lag1_time = 0;}
- if (self.lag2_time) if (time > self.lag2_time) {self.lag_func(self.lag2_time, self.lag2_float1, self.lag2_float2, self.lag2_entity1, self.lag2_vec1, self.lag2_vec2, self.lag2_vec3, self.lag2_vec4);self.lag2_time = 0;}
- if (self.lag3_time) if (time > self.lag3_time) {self.lag_func(self.lag3_time, self.lag3_float1, self.lag3_float2, self.lag3_entity1, self.lag3_vec1, self.lag3_vec2, self.lag3_vec3, self.lag3_vec4);self.lag3_time = 0;}
- if (self.lag4_time) if (time > self.lag4_time) {self.lag_func(self.lag4_time, self.lag4_float1, self.lag4_float2, self.lag4_entity1, self.lag4_vec1, self.lag4_vec2, self.lag4_vec3, self.lag4_vec4);self.lag4_time = 0;}
- if (self.lag5_time) if (time > self.lag5_time) {self.lag_func(self.lag5_time, self.lag5_float1, self.lag5_float2, self.lag5_entity1, self.lag5_vec1, self.lag5_vec2, self.lag5_vec3, self.lag5_vec4);self.lag5_time = 0;}
+void lag_update(entity this)
+{
+ if (this.lag1_time) if (time > this.lag1_time) {this.lag_func(this, this.lag1_time, this.lag1_float1, this.lag1_float2, this.lag1_entity1, this.lag1_vec1, this.lag1_vec2, this.lag1_vec3, this.lag1_vec4);this.lag1_time = 0;}
+ if (this.lag2_time) if (time > this.lag2_time) {this.lag_func(this, this.lag2_time, this.lag2_float1, this.lag2_float2, this.lag2_entity1, this.lag2_vec1, this.lag2_vec2, this.lag2_vec3, this.lag2_vec4);this.lag2_time = 0;}
+ if (this.lag3_time) if (time > this.lag3_time) {this.lag_func(this, this.lag3_time, this.lag3_float1, this.lag3_float2, this.lag3_entity1, this.lag3_vec1, this.lag3_vec2, this.lag3_vec3, this.lag3_vec4);this.lag3_time = 0;}
+ if (this.lag4_time) if (time > this.lag4_time) {this.lag_func(this, this.lag4_time, this.lag4_float1, this.lag4_float2, this.lag4_entity1, this.lag4_vec1, this.lag4_vec2, this.lag4_vec3, this.lag4_vec4);this.lag4_time = 0;}
+ if (this.lag5_time) if (time > this.lag5_time) {this.lag_func(this, this.lag5_time, this.lag5_float1, this.lag5_float2, this.lag5_entity1, this.lag5_vec1, this.lag5_vec2, this.lag5_vec3, this.lag5_vec4);this.lag5_time = 0;}
}
-float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
-{SELFPARAM();
- if (self.lag1_time == 0) {self.lag1_time = t;self.lag1_float1 = f1;self.lag1_float2 = f2;self.lag1_entity1 = e1;self.lag1_vec1 = v1;self.lag1_vec2 = v2;self.lag1_vec3 = v3;self.lag1_vec4 = v4;return true;}
- if (self.lag2_time == 0) {self.lag2_time = t;self.lag2_float1 = f1;self.lag2_float2 = f2;self.lag2_entity1 = e1;self.lag2_vec1 = v1;self.lag2_vec2 = v2;self.lag2_vec3 = v3;self.lag2_vec4 = v4;return true;}
- if (self.lag3_time == 0) {self.lag3_time = t;self.lag3_float1 = f1;self.lag3_float2 = f2;self.lag3_entity1 = e1;self.lag3_vec1 = v1;self.lag3_vec2 = v2;self.lag3_vec3 = v3;self.lag3_vec4 = v4;return true;}
- if (self.lag4_time == 0) {self.lag4_time = t;self.lag4_float1 = f1;self.lag4_float2 = f2;self.lag4_entity1 = e1;self.lag4_vec1 = v1;self.lag4_vec2 = v2;self.lag4_vec3 = v3;self.lag4_vec4 = v4;return true;}
- if (self.lag5_time == 0) {self.lag5_time = t;self.lag5_float1 = f1;self.lag5_float2 = f2;self.lag5_entity1 = e1;self.lag5_vec1 = v1;self.lag5_vec2 = v2;self.lag5_vec3 = v3;self.lag5_vec4 = v4;return true;}
+float lag_additem(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
+{
+ if (this.lag1_time == 0) {this.lag1_time = t;this.lag1_float1 = f1;this.lag1_float2 = f2;this.lag1_entity1 = e1;this.lag1_vec1 = v1;this.lag1_vec2 = v2;this.lag1_vec3 = v3;this.lag1_vec4 = v4;return true;}
+ if (this.lag2_time == 0) {this.lag2_time = t;this.lag2_float1 = f1;this.lag2_float2 = f2;this.lag2_entity1 = e1;this.lag2_vec1 = v1;this.lag2_vec2 = v2;this.lag2_vec3 = v3;this.lag2_vec4 = v4;return true;}
+ if (this.lag3_time == 0) {this.lag3_time = t;this.lag3_float1 = f1;this.lag3_float2 = f2;this.lag3_entity1 = e1;this.lag3_vec1 = v1;this.lag3_vec2 = v2;this.lag3_vec3 = v3;this.lag3_vec4 = v4;return true;}
+ if (this.lag4_time == 0) {this.lag4_time = t;this.lag4_float1 = f1;this.lag4_float2 = f2;this.lag4_entity1 = e1;this.lag4_vec1 = v1;this.lag4_vec2 = v2;this.lag4_vec3 = v3;this.lag4_vec4 = v4;return true;}
+ if (this.lag5_time == 0) {this.lag5_time = t;this.lag5_float1 = f1;this.lag5_float2 = f2;this.lag5_entity1 = e1;this.lag5_vec1 = v1;this.lag5_vec2 = v2;this.lag5_vec3 = v3;this.lag5_vec4 = v4;return true;}
// no room for it (what is the best thing to do here??)
return false;
}
-float bot_shouldattack(entity e)
-{SELFPARAM();
- if (e.team == self.team)
+bool bot_shouldattack(entity this, entity targ)
+{
+ if (targ.team == this.team)
{
- if (e == self)
+ if (targ == this)
return false;
if (teamplay)
- if (e.team != 0)
+ if (targ.team != 0)
return false;
}
- if(STAT(FROZEN, e))
+ if(STAT(FROZEN, targ))
return false;
if(teamplay)
{
- if(e.team==0)
+ if(targ.team==0)
return false;
}
else if(bot_ignore_bots)
- if(IS_BOT_CLIENT(e))
+ if(IS_BOT_CLIENT(targ))
return false;
- if (!e.takedamage)
+ if (!targ.takedamage)
return false;
- if (IS_DEAD(e))
+ if (IS_DEAD(targ))
return false;
- if (PHYS_INPUT_BUTTON_CHAT(e))
+ if (PHYS_INPUT_BUTTON_CHAT(targ))
return false;
- if(e.flags & FL_NOTARGET)
+ if(targ.flags & FL_NOTARGET)
return false;
- if(MUTATOR_CALLHOOK(BotShouldAttack, e))
+ if(MUTATOR_CALLHOOK(BotShouldAttack, this, targ))
return false;
return true;
}
-void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
-{SELFPARAM();
- if(self.flags & FL_INWATER)
+void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
+{
+ if(this.flags & FL_INWATER)
{
- self.bot_aimtarg = world;
+ this.bot_aimtarg = world;
return;
}
- self.bot_aimtarg = e1;
- self.bot_aimlatency = self.ping; // FIXME? Shouldn't this be in the lag item?
- self.bot_aimselforigin = v1;
- self.bot_aimselfvelocity = v2;
- self.bot_aimtargorigin = v3;
- self.bot_aimtargvelocity = v4;
+ this.bot_aimtarg = e1;
+ this.bot_aimlatency = this.ping; // FIXME? Shouldn't this be in the lag item?
+ this.bot_aimselforigin = v1;
+ this.bot_aimselfvelocity = v2;
+ this.bot_aimtargorigin = v3;
+ this.bot_aimtargvelocity = v4;
if(skill <= 0)
- self.bot_canfire = (random() < 0.8);
+ this.bot_canfire = (random() < 0.8);
else if(skill <= 1)
- self.bot_canfire = (random() < 0.9);
+ this.bot_canfire = (random() < 0.9);
else if(skill <= 2)
- self.bot_canfire = (random() < 0.95);
+ this.bot_canfire = (random() < 0.95);
else
- self.bot_canfire = 1;
+ this.bot_canfire = 1;
}
-float bot_aimdir(vector v, float maxfiredeviation)
-{SELFPARAM();
+float bot_aimdir(entity this, vector v, float maxfiredeviation)
+{
float dist, delta_t, blend;
vector desiredang, diffang;
- //dprint("aim ", self.netname, ": old:", vtos(self.v_angle));
+ //dprint("aim ", this.netname, ": old:", vtos(this.v_angle));
// make sure v_angle is sane first
- self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
- self.v_angle_z = 0;
+ this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
+ this.v_angle_z = 0;
// get the desired angles to aim at
//dprint(" at:", vtos(v));
v = normalize(v);
- //te_lightning2(world, self.origin + self.view_ofs, self.origin + self.view_ofs + v * 200);
- if (time >= self.bot_badaimtime)
+ //te_lightning2(world, this.origin + this.view_ofs, this.origin + this.view_ofs + v * 200);
+ if (time >= this.bot_badaimtime)
{
- self.bot_badaimtime = max(self.bot_badaimtime + 0.3, time);
- self.bot_badaimoffset = randomvec() * bound(0, 5 - 0.5 * (skill+self.bot_offsetskill), 5) * autocvar_bot_ai_aimskill_offset;
+ this.bot_badaimtime = max(this.bot_badaimtime + 0.3, time);
+ this.bot_badaimoffset = randomvec() * bound(0, 5 - 0.5 * (skill+this.bot_offsetskill), 5) * autocvar_bot_ai_aimskill_offset;
}
- desiredang = vectoangles(v) + self.bot_badaimoffset;
+ desiredang = vectoangles(v) + this.bot_badaimoffset;
//dprint(" desired:", vtos(desiredang));
if (desiredang.x >= 180)
desiredang.x = desiredang.x - 360;
desiredang.x = bound(-90, 0 - desiredang.x, 90);
- desiredang.z = self.v_angle.z;
+ desiredang.z = this.v_angle.z;
//dprint(" / ", vtos(desiredang));
//// pain throws off aim
- //if (self.bot_painintensity)
+ //if (this.bot_painintensity)
//{
// // shake from pain
- // desiredang = desiredang + randomvec() * self.bot_painintensity * 0.2;
+ // desiredang = desiredang + randomvec() * this.bot_painintensity * 0.2;
//}
// calculate turn angles
- diffang = (desiredang - self.bot_olddesiredang);
+ diffang = (desiredang - this.bot_olddesiredang);
// wrap yaw turn
diffang.y = diffang.y - floor(diffang.y / 360) * 360;
if (diffang.y >= 180)
diffang.y = diffang.y - 360;
- self.bot_olddesiredang = desiredang;
+ this.bot_olddesiredang = desiredang;
//dprint(" diff:", vtos(diffang));
- delta_t = time-self.bot_prevaimtime;
- self.bot_prevaimtime = time;
+ delta_t = time-this.bot_prevaimtime;
+ this.bot_prevaimtime = time;
// Here we will try to anticipate the comming aiming direction
- self.bot_1st_order_aimfilter= self.bot_1st_order_aimfilter
- + (diffang * (1 / delta_t) - self.bot_1st_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_1st,1);
- self.bot_2nd_order_aimfilter= self.bot_2nd_order_aimfilter
- + (self.bot_1st_order_aimfilter - self.bot_2nd_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_2nd,1);
- self.bot_3th_order_aimfilter= self.bot_3th_order_aimfilter
- + (self.bot_2nd_order_aimfilter - self.bot_3th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_3th,1);
- self.bot_4th_order_aimfilter= self.bot_4th_order_aimfilter
- + (self.bot_3th_order_aimfilter - self.bot_4th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_4th,1);
- self.bot_5th_order_aimfilter= self.bot_5th_order_aimfilter
- + (self.bot_4th_order_aimfilter - self.bot_5th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_5th,1);
+ this.bot_1st_order_aimfilter= this.bot_1st_order_aimfilter
+ + (diffang * (1 / delta_t) - this.bot_1st_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_1st,1);
+ this.bot_2nd_order_aimfilter= this.bot_2nd_order_aimfilter
+ + (this.bot_1st_order_aimfilter - this.bot_2nd_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_2nd,1);
+ this.bot_3th_order_aimfilter= this.bot_3th_order_aimfilter
+ + (this.bot_2nd_order_aimfilter - this.bot_3th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_3th,1);
+ this.bot_4th_order_aimfilter= this.bot_4th_order_aimfilter
+ + (this.bot_3th_order_aimfilter - this.bot_4th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_4th,1);
+ this.bot_5th_order_aimfilter= this.bot_5th_order_aimfilter
+ + (this.bot_4th_order_aimfilter - this.bot_5th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_5th,1);
//blend = (bound(0,skill,10)*0.1)*pow(1-bound(0,skill,10)*0.05,2.5)*5.656854249; //Plot formule before changing !
- blend = bound(0,skill+self.bot_aimskill,10)*0.1;
+ blend = bound(0,skill+this.bot_aimskill,10)*0.1;
desiredang = desiredang + blend *
(
- self.bot_1st_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_1st
- + self.bot_2nd_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_2nd
- + self.bot_3th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_3th
- + self.bot_4th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_4th
- + self.bot_5th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_5th
+ this.bot_1st_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_1st
+ + this.bot_2nd_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_2nd
+ + this.bot_3th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_3th
+ + this.bot_4th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_4th
+ + this.bot_5th_order_aimfilter * autocvar_bot_ai_aimskill_order_mix_5th
);
// calculate turn angles
- diffang = desiredang - self.bot_mouseaim;
+ diffang = desiredang - this.bot_mouseaim;
// wrap yaw turn
diffang.y = diffang.y - floor(diffang.y / 360) * 360;
if (diffang.y >= 180)
diffang.y = diffang.y - 360;
//dprint(" diff:", vtos(diffang));
- if (time >= self.bot_aimthinktime)
+ if (time >= this.bot_aimthinktime)
{
- self.bot_aimthinktime = max(self.bot_aimthinktime + 0.5 - 0.05*(skill+self.bot_thinkskill), time);
- self.bot_mouseaim = self.bot_mouseaim + diffang * (1-random()*0.1*bound(1,10-(skill+self.bot_thinkskill),10));
+ this.bot_aimthinktime = max(this.bot_aimthinktime + 0.5 - 0.05*(skill+this.bot_thinkskill), time);
+ this.bot_mouseaim = this.bot_mouseaim + diffang * (1-random()*0.1*bound(1,10-(skill+this.bot_thinkskill),10));
}
- //self.v_angle = self.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
+ //this.v_angle = this.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
- diffang = self.bot_mouseaim - desiredang;
+ diffang = this.bot_mouseaim - desiredang;
// wrap yaw turn
diffang.y = diffang.y - floor(diffang.y / 360) * 360;
if (diffang.y >= 180)
desiredang = desiredang + diffang * bound(0,autocvar_bot_ai_aimskill_think,1);
// calculate turn angles
- diffang = desiredang - self.v_angle;
+ diffang = desiredang - this.v_angle;
// wrap yaw turn
diffang.y = diffang.y - floor(diffang.y / 360) * 360;
if (diffang.y >= 180)
fixedrate = autocvar_bot_ai_aimskill_fixedrate / bound(1,dist,1000);
blendrate = autocvar_bot_ai_aimskill_blendrate;
r = max(fixedrate, blendrate);
- //self.v_angle = self.v_angle + diffang * bound(frametime, r * frametime * (2+skill*skill*0.05-random()*0.05*(10-skill)), 1);
- self.v_angle = self.v_angle + diffang * bound(delta_t, r * delta_t * (2+pow(skill+self.bot_mouseskill,3)*0.005-random()), 1);
- self.v_angle = self.v_angle * bound(0,autocvar_bot_ai_aimskill_mouse,1) + desiredang * bound(0,(1-autocvar_bot_ai_aimskill_mouse),1);
- //self.v_angle = self.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
- //self.v_angle = self.v_angle + diffang * (1/ blendrate);
- self.v_angle_z = 0;
- self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
- //dprint(" turn:", vtos(self.v_angle));
-
- makevectors(self.v_angle);
- shotorg = self.origin + self.view_ofs;
+ //this.v_angle = this.v_angle + diffang * bound(frametime, r * frametime * (2+skill*skill*0.05-random()*0.05*(10-skill)), 1);
+ this.v_angle = this.v_angle + diffang * bound(delta_t, r * delta_t * (2+pow(skill+this.bot_mouseskill,3)*0.005-random()), 1);
+ this.v_angle = this.v_angle * bound(0,autocvar_bot_ai_aimskill_mouse,1) + desiredang * bound(0,(1-autocvar_bot_ai_aimskill_mouse),1);
+ //this.v_angle = this.v_angle + diffang * bound(0, r * frametime * (skill * 0.5 + 2), 1);
+ //this.v_angle = this.v_angle + diffang * (1/ blendrate);
+ this.v_angle_z = 0;
+ this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
+ //dprint(" turn:", vtos(this.v_angle));
+
+ makevectors(this.v_angle);
+ shotorg = this.origin + this.view_ofs;
shotdir = v_forward;
//dprint(" dir:", vtos(v_forward));
//te_lightning2(world, shotorg, shotorg + shotdir * 100);
// calculate turn angles again
- //diffang = desiredang - self.v_angle;
+ //diffang = desiredang - this.v_angle;
//diffang_y = diffang_y - floor(diffang_y / 360) * 360;
//if (diffang_y >= 180)
// diffang_y = diffang_y - 360;
// note the maxfiredeviation is in degrees so this has to convert to radians first
//if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
if ((normalize(v) * shotdir) >= cos(maxfiredeviation * (3.14159265358979323846 / 180)))
- if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + self.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+self.bot_aggresskill)*0.05,1))
- self.bot_firetimer = time + bound(0.1, 0.5-(skill+self.bot_aggresskill)*0.05, 0.5);
+ if(vdist(trace_endpos-shotorg, <, 500 + 500 * bound(0, skill + this.bot_aggresskill, 10)) || random()*random()>bound(0,(skill+this.bot_aggresskill)*0.05,1))
+ this.bot_firetimer = time + bound(0.1, 0.5-(skill+this.bot_aggresskill)*0.05, 0.5);
//traceline(shotorg,shotorg+shotdir*1000,false,world);
//dprint(ftos(maxfiredeviation),"\n");
//dprint(" diff:", vtos(diffang), "\n");
- return self.bot_canfire && (time < self.bot_firetimer);
+ return this.bot_canfire && (time < this.bot_firetimer);
}
vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay)
return targorigin + targvelocity * (shotdelay + vlen(targorigin - shotorg) / shotspeed);
}
-float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
-{SELFPARAM();
+bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity)
+{
float f, r, hf, distanceratio;
vector v;
/*
- eprint(self);
+ eprint(this);
dprint("bot_aim(", ftos(shotspeed));
dprint(", ", ftos(shotspeedupward));
dprint(", ", ftos(maxshottime));
dprint(");\n");
*/
- hf = self.dphitcontentsmask;
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ hf = this.dphitcontentsmask;
+ this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
shotspeed *= W_WeaponSpeedFactor();
shotspeedupward *= W_WeaponSpeedFactor();
if (!shotspeed)
{
- LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " shotspeed is zero!\n");
+ LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " shotspeed is zero!\n");
shotspeed = 1000000;
}
if (!maxshottime)
{
- LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " maxshottime is zero!\n");
+ LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " maxshottime is zero!\n");
maxshottime = 1;
}
- makevectors(self.v_angle);
- shotorg = self.origin + self.view_ofs;
+ makevectors(this.v_angle);
+ shotorg = this.origin + this.view_ofs;
shotdir = v_forward;
- v = bot_shotlead(self.bot_aimtargorigin, self.bot_aimtargvelocity, shotspeed, self.bot_aimlatency);
+ v = bot_shotlead(this.bot_aimtargorigin, this.bot_aimtargvelocity, shotspeed, this.bot_aimlatency);
distanceratio = sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees;
distanceratio = bound(0,distanceratio,1);
r = (autocvar_bot_ai_aimskill_firetolerance_maxdegrees-autocvar_bot_ai_aimskill_firetolerance_mindegrees)
* (1-distanceratio) + autocvar_bot_ai_aimskill_firetolerance_mindegrees;
- if (applygravity && self.bot_aimtarg)
+ if (applygravity && this.bot_aimtarg)
{
- if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', self.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, self))
+ if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', this.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, this))
{
- self.dphitcontentsmask = hf;
+ this.dphitcontentsmask = hf;
return false;
}
- f = bot_aimdir(findtrajectory_velocity - shotspeedupward * '0 0 1', r);
+ f = bot_aimdir(this, findtrajectory_velocity - shotspeedupward * '0 0 1', r);
}
else
{
- f = bot_aimdir(v - shotorg, r);
- //dprint("AIM: ");dprint(vtos(self.bot_aimtargorigin));dprint(" + ");dprint(vtos(self.bot_aimtargvelocity));dprint(" * ");dprint(ftos(self.bot_aimlatency + vlen(self.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
- //traceline(shotorg, shotorg + shotdir * 10000, false, self);
+ f = bot_aimdir(this, v - shotorg, r);
+ //dprint("AIM: ");dprint(vtos(this.bot_aimtargorigin));dprint(" + ");dprint(vtos(this.bot_aimtargvelocity));dprint(" * ");dprint(ftos(this.bot_aimlatency + vlen(this.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n");
+ //traceline(shotorg, shotorg + shotdir * 10000, false, this);
//if (trace_ent.takedamage)
//if (trace_fraction < 1)
- //if (!bot_shouldattack(trace_ent))
+ //if (!bot_shouldattack(this, trace_ent))
// return false;
- traceline(shotorg, self.bot_aimtargorigin, false, self);
+ traceline(shotorg, this.bot_aimtargorigin, false, this);
if (trace_fraction < 1)
- if (trace_ent != self.enemy)
- if (!bot_shouldattack(trace_ent))
+ if (trace_ent != this.enemy)
+ if (!bot_shouldattack(this, trace_ent))
{
- self.dphitcontentsmask = hf;
+ this.dphitcontentsmask = hf;
return false;
}
}
//if (r > maxshottime * shotspeed)
// return false;
- self.dphitcontentsmask = hf;
+ this.dphitcontentsmask = hf;
return true;
}
-#ifndef AIM_H
-#define AIM_H
+#pragma once
/*
* Globals and Fields
*/
* Functions
*/
-float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
-void lag_update();
-void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
+float lag_additem(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
+void lag_update(entity this);
+void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4);
-float bot_shouldattack(entity e);
-float bot_aimdir(vector v, float maxfiredeviation);
-float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity);
+float bot_shouldattack(entity this, entity targ);
+float bot_aimdir(entity this, vector v, float maxfiredeviation);
+bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity);
float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, float shotspeed, float shotspeedupward, float maxtime, float shotdelay, entity ignore);
vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay);
-.void(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) lag_func;
-#endif
+.void(entity this, float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) lag_func;
#include "../weapons/accuracy.qh"
+#include <common/physics/player.qh>
#include <common/constants.qh>
#include <common/mapinfo.qh>
#include <common/teams.qh>
#include <lib/warpzone/util_server.qh>
entity bot_spawn()
-{SELFPARAM();
+{
entity bot = spawnclient();
if (bot)
{
currentbots = currentbots + 1;
- setself(bot);
- bot_setnameandstuff();
- ClientConnect();
- PutClientInServer();
- setself(this);
+ bot_setnameandstuff(bot);
+ WITHSELF(bot, ClientConnect());
+ WITHSELF(bot, PutClientInServer());
}
return bot;
}
-void bot_think()
-{SELFPARAM();
- if (self.bot_nextthink > time)
+void bot_think(entity this)
+{
+ if (this.bot_nextthink > time)
return;
- self.flags &= ~FL_GODMODE;
+ this.flags &= ~FL_GODMODE;
if(autocvar_bot_god)
- self.flags |= FL_GODMODE;
+ this.flags |= FL_GODMODE;
- self.bot_nextthink = self.bot_nextthink + autocvar_bot_ai_thinkinterval * pow(0.5, self.bot_aiskill);
- //if (self.bot_painintensity > 0)
- // self.bot_painintensity = self.bot_painintensity - (skill + 1) * 40 * frametime;
+ this.bot_nextthink = this.bot_nextthink + autocvar_bot_ai_thinkinterval * pow(0.5, this.bot_aiskill);
+ //if (this.bot_painintensity > 0)
+ // this.bot_painintensity = this.bot_painintensity - (skill + 1) * 40 * frametime;
- //self.bot_painintensity = self.bot_painintensity + self.bot_oldhealth - self.health;
- //self.bot_painintensity = bound(0, self.bot_painintensity, 100);
+ //this.bot_painintensity = this.bot_painintensity + this.bot_oldhealth - this.health;
+ //this.bot_painintensity = bound(0, this.bot_painintensity, 100);
- if (!IS_PLAYER(self) || (autocvar_g_campaign && !campaign_bots_may_start))
+ if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
{
- self.bot_nextthink = time + 0.5;
+ this.bot_nextthink = time + 0.5;
return;
}
- if (self.fixangle)
+ if (this.fixangle)
{
- self.v_angle = self.angles;
- self.v_angle_z = 0;
- self.fixangle = false;
+ this.v_angle = this.angles;
+ this.v_angle_z = 0;
+ this.fixangle = false;
}
- self.dmg_take = 0;
- self.dmg_save = 0;
- self.dmg_inflictor = world;
+ this.dmg_take = 0;
+ this.dmg_save = 0;
+ this.dmg_inflictor = world;
// calculate an aiming latency based on the skill setting
// (simulated network latency + naturally delayed reflexes)
- //self.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
+ //this.ping = 0.7 - bound(0, 0.05 * skill, 0.5); // moved the reflexes to bot_aimdir (under the name 'think')
// minimum ping 20+10 random
- self.ping = bound(0,0.07 - bound(0, (skill + self.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
+ this.ping = bound(0,0.07 - bound(0, (skill + this.bot_pingskill) * 0.005,0.05)+random()*0.01,0.65); // Now holds real lag to server, and higer skill players take a less laggy server
// skill 10 = ping 0.2 (adrenaline)
// skill 0 = ping 0.7 (slightly drunk)
// clear buttons
- PHYS_INPUT_BUTTON_ATCK(self) = false;
- PHYS_INPUT_BUTTON_JUMP(self) = false;
- PHYS_INPUT_BUTTON_ATCK2(self) = false;
- PHYS_INPUT_BUTTON_ZOOM(self) = false;
- PHYS_INPUT_BUTTON_CROUCH(self) = false;
- PHYS_INPUT_BUTTON_HOOK(self) = false;
- PHYS_INPUT_BUTTON_INFO(self) = false;
- PHYS_INPUT_BUTTON_DRAG(self) = false;
- PHYS_INPUT_BUTTON_CHAT(self) = false;
- PHYS_INPUT_BUTTON_USE(self) = false;
+ PHYS_INPUT_BUTTON_ATCK(this) = false;
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
+ PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ PHYS_INPUT_BUTTON_ZOOM(this) = false;
+ PHYS_INPUT_BUTTON_CROUCH(this) = false;
+ PHYS_INPUT_BUTTON_HOOK(this) = false;
+ PHYS_INPUT_BUTTON_INFO(this) = false;
+ PHYS_INPUT_BUTTON_DRAG(this) = false;
+ PHYS_INPUT_BUTTON_CHAT(this) = false;
+ PHYS_INPUT_BUTTON_USE(this) = false;
if (time < game_starttime)
{
// block the bot during the countdown to game start
- self.movement = '0 0 0';
- self.bot_nextthink = game_starttime;
+ this.movement = '0 0 0';
+ this.bot_nextthink = game_starttime;
return;
}
// if dead, just wait until we can respawn
- if (IS_DEAD(self))
+ if (IS_DEAD(this))
{
- if (self.deadflag == DEAD_DEAD)
+ if (this.deadflag == DEAD_DEAD)
{
- PHYS_INPUT_BUTTON_JUMP(self) = true; // press jump to respawn
- self.bot_strategytime = 0;
+ PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
+ this.bot_strategytime = 0;
}
}
- else if(self.aistatus & AI_STATUS_STUCK)
- navigation_unstuck();
+ else if(this.aistatus & AI_STATUS_STUCK)
+ navigation_unstuck(this);
// now call the current bot AI (havocbot for example)
- self.bot_ai();
+ this.bot_ai(this);
}
-void bot_setnameandstuff()
-{SELFPARAM();
+void bot_setnameandstuff(entity this)
+{
string readfile, s;
float file, tokens, prio;
if(argv(4) != "" && stof(argv(4)) >= 0) bot_pants = argv(4);
else bot_pants = ftos(floor(random() * 15));
- self.bot_forced_team = stof(argv(5));
+ this.bot_forced_team = stof(argv(5));
prio = 6;
- #define READSKILL(f,w,r) if(argv(prio) != "") self.f = stof(argv(prio)) * (w); else self.f = (!autocvar_g_campaign) * (2 * random() - 1) * (r) * (w); ++prio
+ #define READSKILL(f,w,r) if(argv(prio) != "") this.f = stof(argv(prio)) * (w); else this.f = (!autocvar_g_campaign) * (2 * random() - 1) * (r) * (w); ++prio
//print(bot_name, ": ping=", argv(9), "\n");
READSKILL(havocbot_keyboardskill, 0.5, 0.5); // keyboard skill
READSKILL(bot_thinkskill, 1, 0.5); // think skill
READSKILL(bot_aiskill, 2, 0); // "ai" skill
- self.bot_config_loaded = true;
+ this.bot_config_loaded = true;
// this is really only a default, JoinBestTeam is called later
- setcolor(self, stof(bot_shirt) * 16 + stof(bot_pants));
- self.bot_preferredcolors = self.clientcolors;
+ setcolor(this, stof(bot_shirt) * 16 + stof(bot_pants));
+ this.bot_preferredcolors = this.clientcolors;
// pick the name
if (autocvar_bot_usemodelnames)
++j;
));
if (j)
- self.netname = self.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
+ this.netname = this.netname_freeme = strzone(strcat(prefix, name, "(", ftos(j), ")", suffix));
else
- self.netname = self.netname_freeme = strzone(strcat(prefix, name, suffix));
+ this.netname = this.netname_freeme = strzone(strcat(prefix, name, suffix));
- self.cleanname = strzone(name);
+ this.cleanname = strzone(name);
// pick the model and skin
if(substring(bot_model, -4, 1) != ".")
bot_model = strcat(bot_model, ".iqm");
- self.playermodel = self.playermodel_freeme = strzone(strcat("models/player/", bot_model));
- self.playerskin = self.playerskin_freeme = strzone(bot_skin);
+ this.playermodel = this.playermodel_freeme = strzone(strcat("models/player/", bot_model));
+ this.playerskin = this.playerskin_freeme = strzone(bot_skin);
- self.cvar_cl_accuracy_data_share = 1; // share the bots weapon accuracy data with the world
- self.cvar_cl_accuracy_data_receive = 0; // don't receive any weapon accuracy data
+ this.cvar_cl_accuracy_data_share = 1; // share the bots weapon accuracy data with the world
+ this.cvar_cl_accuracy_data_receive = 0; // don't receive any weapon accuracy data
}
void bot_custom_weapon_priority_setup()
bot_strategytoken_taken = true;
}
-void bot_clientdisconnect()
-{SELFPARAM();
- if (!IS_BOT_CLIENT(self))
+void bot_clientdisconnect(entity this)
+{
+ if (!IS_BOT_CLIENT(this))
return;
- bot_clearqueue(self);
- if(self.cleanname)
- strunzone(self.cleanname);
- if(self.netname_freeme)
- strunzone(self.netname_freeme);
- if(self.playermodel_freeme)
- strunzone(self.playermodel_freeme);
- if(self.playerskin_freeme)
- strunzone(self.playerskin_freeme);
- self.cleanname = string_null;
- self.netname_freeme = string_null;
- self.playermodel_freeme = string_null;
- self.playerskin_freeme = string_null;
- if(self.bot_cmd_current)
- remove(self.bot_cmd_current);
- if(bot_waypoint_queue_owner==self)
+ bot_clearqueue(this);
+ if(this.cleanname)
+ strunzone(this.cleanname);
+ if(this.netname_freeme)
+ strunzone(this.netname_freeme);
+ if(this.playermodel_freeme)
+ strunzone(this.playermodel_freeme);
+ if(this.playerskin_freeme)
+ strunzone(this.playerskin_freeme);
+ this.cleanname = string_null;
+ this.netname_freeme = string_null;
+ this.playermodel_freeme = string_null;
+ this.playerskin_freeme = string_null;
+ if(this.bot_cmd_current)
+ remove(this.bot_cmd_current);
+ if(bot_waypoint_queue_owner==this)
bot_waypoint_queue_owner = world;
}
void bot_clientconnect(entity this)
{
if (!IS_BOT_CLIENT(this)) return;
- self.bot_preferredcolors = self.clientcolors;
- self.bot_nextthink = time - random();
- self.lag_func = bot_lagfunc;
- self.isbot = true;
- self.createdtime = self.bot_nextthink;
-
- if(!self.bot_config_loaded) // This is needed so team overrider doesn't break between matches
- bot_setnameandstuff();
-
- if(self.bot_forced_team==1)
- self.team = NUM_TEAM_1;
- else if(self.bot_forced_team==2)
- self.team = NUM_TEAM_2;
- else if(self.bot_forced_team==3)
- self.team = NUM_TEAM_3;
- else if(self.bot_forced_team==4)
- self.team = NUM_TEAM_4;
+ this.bot_preferredcolors = this.clientcolors;
+ this.bot_nextthink = time - random();
+ this.lag_func = bot_lagfunc;
+ this.isbot = true;
+ this.createdtime = this.bot_nextthink;
+
+ if(!this.bot_config_loaded) // This is needed so team overrider doesn't break between matches
+ bot_setnameandstuff(this);
+
+ if(this.bot_forced_team==1)
+ this.team = NUM_TEAM_1;
+ else if(this.bot_forced_team==2)
+ this.team = NUM_TEAM_2;
+ else if(this.bot_forced_team==3)
+ this.team = NUM_TEAM_3;
+ else if(this.bot_forced_team==4)
+ this.team = NUM_TEAM_4;
else
- JoinBestTeam(self, false, true);
+ JoinBestTeam(this, false, true);
- havocbot_setupbot();
+ havocbot_setupbot(this);
}
void bot_removefromlargestteam()
-#ifndef BOT_H
-#define BOT_H
+#pragma once
/*
* Globals and Fields
*/
entity bot_spawn();
float bot_fixcount();
-void bot_think();
-void bot_setnameandstuff();
+void bot_think(entity this);
+void bot_setnameandstuff(entity this);
void bot_custom_weapon_priority_setup();
void bot_endgame();
void bot_relinkplayerlist();
-void bot_clientdisconnect();
+void bot_clientdisconnect(entity this);
void bot_clientconnect(entity this);
void bot_removefromlargestteam();
void bot_removenewest();
void autoskill(float factor);
void bot_serverframe();
-.void() bot_ai;
+.void(entity this) bot_ai;
.float(entity player, entity item) bot_pickupevalfunc;
/*
* Imports
*/
-void() havocbot_setupbot;
+void(entity this) havocbot_setupbot;
void bot_calculate_stepheightvec();
-#endif
+++ /dev/null
-#include "havocbot.qc"
-#include "roles.qc"
--- /dev/null
+// generated file; do not modify
+#include "havocbot.qc"
+#include "roles.qc"
#include "../waypoints.qh"
#include <common/constants.qh>
+#include <common/physics/player.qh>
+#include <common/state.qh>
#include <common/items/all.qh>
#include <common/triggers/trigger/jumppads.qh>
.float speed;
-void havocbot_ai()
-{SELFPARAM();
- if(self.draggedby)
+void havocbot_ai(entity this)
+{
+ if(this.draggedby)
return;
- if(bot_execute_commands())
+ if(bot_execute_commands(this))
return;
- if (bot_strategytoken == self)
+ if (bot_strategytoken == this)
if (!bot_strategytoken_taken)
{
- if(self.havocbot_blockhead)
+ if(this.havocbot_blockhead)
{
- self.havocbot_blockhead = false;
+ this.havocbot_blockhead = false;
}
else
{
- if (!self.jumppadcount)
- self.havocbot_role();
+ if (!this.jumppadcount)
+ this.havocbot_role(this); // little too far down the rabbit hole
}
// TODO: tracewalk() should take care of this job (better path finding under water)
// if we don't have a goal and we're under water look for a waypoint near the "shore" and push it
- if(IS_DEAD(self))
- if(self.goalcurrent==world)
- if(self.waterlevel==WATERLEVEL_SWIMMING || (self.aistatus & AI_STATUS_OUT_WATER))
+ if(IS_DEAD(this))
+ if(this.goalcurrent==world)
+ if(this.waterlevel==WATERLEVEL_SWIMMING || (this.aistatus & AI_STATUS_OUT_WATER))
{
// Look for the closest waypoint out of water
entity newgoal, head;
bestdistance = 10000;
for (head = findchain(classname, "waypoint"); head; head = head.chain)
{
- distance = vlen(head.origin - self.origin);
+ distance = vlen(head.origin - this.origin);
if(distance>10000)
continue;
- if(head.origin.z < self.origin.z)
+ if(head.origin.z < this.origin.z)
continue;
- if(head.origin.z - self.origin.z - self.view_ofs.z > 100)
+ if(head.origin.z - this.origin.z - this.view_ofs.z > 100)
continue;
if (pointcontents(head.origin + head.maxs + '0 0 1') != CONTENT_EMPTY)
continue;
- traceline(self.origin + self.view_ofs , head.origin, true, head);
+ traceline(this.origin + this.view_ofs , head.origin, true, head);
if(trace_fraction<1)
continue;
if(newgoal)
{
// te_wizspike(newgoal.origin);
- navigation_pushroute(newgoal);
+ navigation_pushroute(this, newgoal);
}
}
bot_strategytoken_taken = true;
}
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
return;
- havocbot_chooseenemy();
- if (self.bot_chooseweapontime < time )
+ havocbot_chooseenemy(this);
+ if (this.bot_chooseweapontime < time )
{
- self.bot_chooseweapontime = time + autocvar_bot_ai_chooseweaponinterval;
- havocbot_chooseweapon();
+ this.bot_chooseweapontime = time + autocvar_bot_ai_chooseweaponinterval;
+ havocbot_chooseweapon(this);
}
- havocbot_aim();
- lag_update();
- if (self.bot_aimtarg)
+ havocbot_aim(this);
+ lag_update(this);
+ if (this.bot_aimtarg)
{
- self.aistatus |= AI_STATUS_ATTACKING;
- self.aistatus &= ~AI_STATUS_ROAMING;
+ this.aistatus |= AI_STATUS_ATTACKING;
+ this.aistatus &= ~AI_STATUS_ROAMING;
- if(self.weapons)
+ if(this.weapons)
{
- Weapon w = PS(self).m_weapon;
+ Weapon w = PS(this).m_weapon;
w.wr_aim(w);
- if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
+ if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
{
- PHYS_INPUT_BUTTON_ATCK(self) = false;
- PHYS_INPUT_BUTTON_ATCK2(self) = false;
+ PHYS_INPUT_BUTTON_ATCK(this) = false;
+ PHYS_INPUT_BUTTON_ATCK2(this) = false;
}
else
{
- if(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))
- self.lastfiredweapon = PS(self).m_weapon.m_id;
+ if(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))
+ this.lastfiredweapon = PS(this).m_weapon.m_id;
}
}
else
{
- if(IS_PLAYER(self.bot_aimtarg))
- bot_aimdir(self.bot_aimtarg.origin + self.bot_aimtarg.view_ofs - self.origin - self.view_ofs , -1);
+ if(IS_PLAYER(this.bot_aimtarg))
+ bot_aimdir(this, this.bot_aimtarg.origin + this.bot_aimtarg.view_ofs - this.origin - this.view_ofs , -1);
}
}
- else if (self.goalcurrent)
+ else if (this.goalcurrent)
{
- self.aistatus |= AI_STATUS_ROAMING;
- self.aistatus &= ~AI_STATUS_ATTACKING;
+ this.aistatus |= AI_STATUS_ROAMING;
+ this.aistatus &= ~AI_STATUS_ATTACKING;
vector now,v,next;//,heading;
float aimdistance,skillblend,distanceblend,blend;
- next = now = ( (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5) - (self.origin + self.view_ofs);
+ next = now = ( (this.goalcurrent.absmin + this.goalcurrent.absmax) * 0.5) - (this.origin + this.view_ofs);
aimdistance = vlen(now);
- //heading = self.velocity;
- //dprint(self.goalstack01.classname,etos(self.goalstack01),"\n");
+ //heading = this.velocity;
+ //dprint(this.goalstack01.classname,etos(this.goalstack01),"\n");
if(
- self.goalstack01 != self && self.goalstack01 != world && ((self.aistatus & AI_STATUS_RUNNING) == 0) &&
- !(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
+ this.goalstack01 != this && this.goalstack01 != world && ((this.aistatus & AI_STATUS_RUNNING) == 0) &&
+ !(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
)
- next = ((self.goalstack01.absmin + self.goalstack01.absmax) * 0.5) - (self.origin + self.view_ofs);
+ next = ((this.goalstack01.absmin + this.goalstack01.absmax) * 0.5) - (this.origin + this.view_ofs);
- skillblend=bound(0,(skill+self.bot_moveskill-2.5)*0.5,1); //lower skill player can't preturn
+ skillblend=bound(0,(skill+this.bot_moveskill-2.5)*0.5,1); //lower skill player can't preturn
distanceblend=bound(0,aimdistance/autocvar_bot_ai_keyboard_distance,1);
blend = skillblend * (1-distanceblend);
//v = (now * (distanceblend) + next * (1-distanceblend)) * (skillblend) + now * (1-skillblend);
//v = now * (distanceblend) * (skillblend) + next * (1-distanceblend) * (skillblend) + now * (1-skillblend);
//v = now * ((1-skillblend) + (distanceblend) * (skillblend)) + next * (1-distanceblend) * (skillblend);
v = now + blend * (next - now);
- //dprint(etos(self), " ");
+ //dprint(etos(this), " ");
//dprint(vtos(now), ":", vtos(next), "=", vtos(v), " (blend ", ftos(blend), ")\n");
//v = now * (distanceblend) + next * (1-distanceblend);
- if (self.waterlevel < WATERLEVEL_SWIMMING)
+ if (this.waterlevel < WATERLEVEL_SWIMMING)
v.z = 0;
//dprint("walk at:", vtos(v), "\n");
- //te_lightning2(world, self.origin, self.goalcurrent.origin);
- bot_aimdir(v, -1);
+ //te_lightning2(world, this.origin, this.goalcurrent.origin);
+ bot_aimdir(this, v, -1);
}
- havocbot_movetogoal();
+ havocbot_movetogoal(this);
// if the bot is not attacking, consider reloading weapons
- if (!(self.aistatus & AI_STATUS_ATTACKING))
+ if (!(this.aistatus & AI_STATUS_ATTACKING))
{
// we are currently holding a weapon that's not fully loaded, reload it
if(skill >= 2) // bots can only reload the held weapon on purpose past this skill
- if(self.clip_load < self.clip_size)
- self.impulse = 20; // "press" the reload button, not sure if this is done right
+ if(this.clip_load < this.clip_size)
+ this.impulse = 20; // "press" the reload button, not sure if this is done right
// if we're not reloading a weapon, switch to any weapon in our invnetory that's not fully loaded to reload it next
// the code above executes next frame, starting the reloading then
if(skill >= 5) // bots can only look for unloaded weapons past this skill
- if(self.clip_load >= 0) // only if we're not reloading a weapon already
+ if(this.clip_load >= 0) // only if we're not reloading a weapon already
{
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if((self.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[it.m_id] < it.reloading_ammo))
- PS(self).m_switchweapon = it;
+ if((this.weapons & (it.m_wepset)) && (it.spawnflags & WEP_FLAG_RELOADABLE) && (this.weapon_load[it.m_id] < it.reloading_ammo))
+ PS(this).m_switchweapon = it;
));
}
}
}
-void havocbot_keyboard_movement(vector destorg)
-{SELFPARAM();
+void havocbot_keyboard_movement(entity this, vector destorg)
+{
vector keyboard;
float blend, maxspeed;
float sk;
- sk = skill + self.bot_moveskill;
+ sk = skill + this.bot_moveskill;
maxspeed = autocvar_sv_maxspeed;
- if (time < self.havocbot_keyboardtime)
+ if (time < this.havocbot_keyboardtime)
return;
- self.havocbot_keyboardtime =
+ this.havocbot_keyboardtime =
max(
- self.havocbot_keyboardtime
- + 0.05/max(1, sk+self.havocbot_keyboardskill)
- + random()*0.025/max(0.00025, skill+self.havocbot_keyboardskill)
+ this.havocbot_keyboardtime
+ + 0.05/max(1, sk+this.havocbot_keyboardskill)
+ + random()*0.025/max(0.00025, skill+this.havocbot_keyboardskill)
, time);
- keyboard = self.movement * (1.0 / maxspeed);
+ keyboard = this.movement * (1.0 / maxspeed);
float trigger, trigger1;
blend = bound(0,sk*0.1,1);
else
keyboard.z = 0;
- self.havocbot_keyboard = keyboard * maxspeed;
- if (self.havocbot_ducktime>time) PHYS_INPUT_BUTTON_CROUCH(self) = true;
+ this.havocbot_keyboard = keyboard * maxspeed;
+ if (this.havocbot_ducktime>time) PHYS_INPUT_BUTTON_CROUCH(this) = true;
- keyboard = self.havocbot_keyboard;
- blend = bound(0,vlen(destorg-self.origin)/autocvar_bot_ai_keyboard_distance,1); // When getting close move with 360 degree
- //dprint("movement ", vtos(self.movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
- self.movement = self.movement + (keyboard - self.movement) * blend;
+ keyboard = this.havocbot_keyboard;
+ blend = bound(0,vlen(destorg-this.origin)/autocvar_bot_ai_keyboard_distance,1); // When getting close move with 360 degree
+ //dprint("movement ", vtos(this.movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
+ this.movement = this.movement + (keyboard - this.movement) * blend;
}
-void havocbot_bunnyhop(vector dir)
-{SELFPARAM();
+void havocbot_bunnyhop(entity this, vector dir)
+{
float bunnyhopdistance;
vector deviation;
float maxspeed;
vector gco, gno;
// Don't jump when attacking
- if(self.aistatus & AI_STATUS_ATTACKING)
+ if(this.aistatus & AI_STATUS_ATTACKING)
return;
- if(IS_PLAYER(self.goalcurrent))
+ if(IS_PLAYER(this.goalcurrent))
return;
maxspeed = autocvar_sv_maxspeed;
- if(self.aistatus & AI_STATUS_DANGER_AHEAD)
+ if(this.aistatus & AI_STATUS_DANGER_AHEAD)
{
- self.aistatus &= ~AI_STATUS_RUNNING;
- PHYS_INPUT_BUTTON_JUMP(self) = false;
- self.bot_canruntogoal = 0;
- self.bot_timelastseengoal = 0;
+ this.aistatus &= ~AI_STATUS_RUNNING;
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
+ this.bot_canruntogoal = 0;
+ this.bot_timelastseengoal = 0;
return;
}
- if(self.waterlevel > WATERLEVEL_WETFEET)
+ if(this.waterlevel > WATERLEVEL_WETFEET)
{
- self.aistatus &= ~AI_STATUS_RUNNING;
+ this.aistatus &= ~AI_STATUS_RUNNING;
return;
}
- if(self.bot_lastseengoal != self.goalcurrent && !(self.aistatus & AI_STATUS_RUNNING))
+ if(this.bot_lastseengoal != this.goalcurrent && !(this.aistatus & AI_STATUS_RUNNING))
{
- self.bot_canruntogoal = 0;
- self.bot_timelastseengoal = 0;
+ this.bot_canruntogoal = 0;
+ this.bot_timelastseengoal = 0;
}
- gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
- bunnyhopdistance = vlen(self.origin - gco);
+ gco = (this.goalcurrent.absmin + this.goalcurrent.absmax) * 0.5;
+ bunnyhopdistance = vlen(this.origin - gco);
// Run only to visible goals
- if(IS_ONGROUND(self))
- if(self.speed==maxspeed)
- if(checkpvs(self.origin + self.view_ofs, self.goalcurrent))
+ if(IS_ONGROUND(this))
+ if(this.speed==maxspeed)
+ if(checkpvs(this.origin + this.view_ofs, this.goalcurrent))
{
- self.bot_lastseengoal = self.goalcurrent;
+ this.bot_lastseengoal = this.goalcurrent;
// seen it before
- if(self.bot_timelastseengoal)
+ if(this.bot_timelastseengoal)
{
// for a period of time
- if(time - self.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
+ if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
{
float checkdistance;
checkdistance = true;
// don't run if it is too close
- if(self.bot_canruntogoal==0)
+ if(this.bot_canruntogoal==0)
{
if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_startdistance)
- self.bot_canruntogoal = 1;
+ this.bot_canruntogoal = 1;
else
- self.bot_canruntogoal = -1;
+ this.bot_canruntogoal = -1;
}
- if(self.bot_canruntogoal != 1)
+ if(this.bot_canruntogoal != 1)
return;
- if(self.aistatus & AI_STATUS_ROAMING)
- if(self.goalcurrent.classname=="waypoint")
- if (!(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
- if(fabs(gco.z - self.origin.z) < self.maxs.z - self.mins.z)
- if(self.goalstack01!=world)
+ if(this.aistatus & AI_STATUS_ROAMING)
+ if(this.goalcurrent.classname=="waypoint")
+ if (!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
+ if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z)
+ if(this.goalstack01!=world)
{
- gno = (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5;
- deviation = vectoangles(gno - self.origin) - vectoangles(gco - self.origin);
+ gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5;
+ deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin);
while (deviation.y < -180) deviation.y = deviation.y + 360;
while (deviation.y > 180) deviation.y = deviation.y - 360;
if(fabs(deviation.y) < 20)
- if(bunnyhopdistance < vlen(self.origin - gno))
- if(fabs(gno.z - gco.z) < self.maxs.z - self.mins.z)
+ if(bunnyhopdistance < vlen(this.origin - gno))
+ if(fabs(gno.z - gco.z) < this.maxs.z - this.mins.z)
{
- if(vlen(gco - gno) > autocvar_bot_ai_bunnyhop_startdistance)
- if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
+ if(vdist(gco - gno, >, autocvar_bot_ai_bunnyhop_startdistance))
+ if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
{
checkdistance = false;
}
if(checkdistance)
{
- self.aistatus &= ~AI_STATUS_RUNNING;
+ this.aistatus &= ~AI_STATUS_RUNNING;
if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance)
- PHYS_INPUT_BUTTON_JUMP(self) = true;
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
}
else
{
- self.aistatus |= AI_STATUS_RUNNING;
- PHYS_INPUT_BUTTON_JUMP(self) = true;
+ this.aistatus |= AI_STATUS_RUNNING;
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
}
}
}
else
{
- self.bot_timelastseengoal = time;
+ this.bot_timelastseengoal = time;
}
}
else
{
- self.bot_timelastseengoal = 0;
+ this.bot_timelastseengoal = 0;
}
#if 0
// Release jump button
if(!cvar("sv_pogostick"))
- if((IS_ONGROUND(self)) == 0)
+ if((IS_ONGROUND(this)) == 0)
{
- if(self.velocity.z < 0 || vlen(self.velocity)<maxspeed)
- PHYS_INPUT_BUTTON_JUMP(self) = false;
+ if(this.velocity.z < 0 || vlen(this.velocity)<maxspeed)
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
// Strafe
- if(self.aistatus & AI_STATUS_RUNNING)
- if(vlen(self.velocity)>maxspeed)
+ if(this.aistatus & AI_STATUS_RUNNING)
+ if(vlen(this.velocity)>maxspeed)
{
- deviation = vectoangles(dir) - vectoangles(self.velocity);
+ deviation = vectoangles(dir) - vectoangles(this.velocity);
while (deviation.y < -180) deviation.y = deviation.y + 360;
while (deviation.y > 180) deviation.y = deviation.y - 360;
if(fabs(deviation.y)>10)
- self.movement_x = 0;
+ this.movement_x = 0;
if(deviation.y>10)
- self.movement_y = maxspeed * -1;
+ this.movement_y = maxspeed * -1;
else if(deviation.y<10)
- self.movement_y = maxspeed;
+ this.movement_y = maxspeed;
}
}
#endif
}
-void havocbot_movetogoal()
-{SELFPARAM();
+void havocbot_movetogoal(entity this)
+{
vector destorg;
vector diff;
vector dir;
vector gco;
//float dist;
vector dodge;
- //if (self.goalentity)
- // te_lightning2(self, self.origin, (self.goalentity.absmin + self.goalentity.absmax) * 0.5);
- self.movement = '0 0 0';
+ //if (this.goalentity)
+ // te_lightning2(this, this.origin, (this.goalentity.absmin + this.goalentity.absmax) * 0.5);
+ this.movement = '0 0 0';
maxspeed = autocvar_sv_maxspeed;
// Jetpack navigation
- if(self.goalcurrent)
- if(self.navigation_jetpack_goal)
- if(self.goalcurrent==self.navigation_jetpack_goal)
- if(self.ammo_fuel)
+ if(this.goalcurrent)
+ if(this.navigation_jetpack_goal)
+ if(this.goalcurrent==this.navigation_jetpack_goal)
+ if(this.ammo_fuel)
{
if(autocvar_bot_debug_goalstack)
{
- debuggoalstack();
- te_wizspike(self.navigation_jetpack_point);
+ debuggoalstack(this);
+ te_wizspike(this.navigation_jetpack_point);
}
// Take off
- if (!(self.aistatus & AI_STATUS_JETPACK_FLYING))
+ if (!(this.aistatus & AI_STATUS_JETPACK_FLYING))
{
// Brake almost completely so it can get a good direction
- if(vlen(self.velocity)>10)
+ if(vdist(this.velocity, >, 10))
return;
- self.aistatus |= AI_STATUS_JETPACK_FLYING;
+ this.aistatus |= AI_STATUS_JETPACK_FLYING;
}
- makevectors(self.v_angle.y * '0 1 0');
- dir = normalize(self.navigation_jetpack_point - self.origin);
+ makevectors(this.v_angle.y * '0 1 0');
+ dir = normalize(this.navigation_jetpack_point - this.origin);
// Landing
- if(self.aistatus & AI_STATUS_JETPACK_LANDING)
+ if(this.aistatus & AI_STATUS_JETPACK_LANDING)
{
// Calculate brake distance in xy
float db, v, d;
vector dxy;
- dxy = self.origin - ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ); dxy.z = 0;
+ dxy = this.origin - ( ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5 ); dxy.z = 0;
d = vlen(dxy);
- v = vlen(self.velocity - self.velocity.z * '0 0 1');
+ v = vlen(this.velocity - this.velocity.z * '0 0 1');
db = (pow(v,2) / (autocvar_g_jetpack_acceleration_side * 2)) + 100;
// dprint("distance ", ftos(ceil(d)), " velocity ", ftos(ceil(v)), " brake at ", ftos(ceil(db)), "\n");
if(d < db || d < 500)
{
// Brake
- if(fabs(self.velocity.x)>maxspeed*0.3)
+ if(fabs(this.velocity.x)>maxspeed*0.3)
{
- self.movement_x = dir * v_forward * -maxspeed;
+ this.movement_x = dir * v_forward * -maxspeed;
return;
}
// Switch to normal mode
- self.navigation_jetpack_goal = world;
- self.aistatus &= ~AI_STATUS_JETPACK_LANDING;
- self.aistatus &= ~AI_STATUS_JETPACK_FLYING;
+ this.navigation_jetpack_goal = world;
+ this.aistatus &= ~AI_STATUS_JETPACK_LANDING;
+ this.aistatus &= ~AI_STATUS_JETPACK_FLYING;
return;
}
}
- else if(checkpvs(self.origin,self.goalcurrent))
+ else if(checkpvs(this.origin,this.goalcurrent))
{
// If I can see the goal switch to landing code
- self.aistatus &= ~AI_STATUS_JETPACK_FLYING;
- self.aistatus |= AI_STATUS_JETPACK_LANDING;
+ this.aistatus &= ~AI_STATUS_JETPACK_FLYING;
+ this.aistatus |= AI_STATUS_JETPACK_LANDING;
return;
}
// Flying
- PHYS_INPUT_BUTTON_HOOK(self) = true;
- if(self.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < self.origin.z)
+ PHYS_INPUT_BUTTON_HOOK(this) = true;
+ if(this.navigation_jetpack_point.z - STAT(PL_MAX, NULL).z + STAT(PL_MIN, NULL).z < this.origin.z)
{
- self.movement_x = dir * v_forward * maxspeed;
- self.movement_y = dir * v_right * maxspeed;
+ this.movement_x = dir * v_forward * maxspeed;
+ this.movement_y = dir * v_right * maxspeed;
}
return;
}
// Handling of jump pads
- if(self.jumppadcount)
+ if(this.jumppadcount)
{
// If got stuck on the jump pad try to reach the farthest visible waypoint
- if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
+ if(this.aistatus & AI_STATUS_OUT_JUMPPAD)
{
- if(fabs(self.velocity.z)<50)
+ if(fabs(this.velocity.z)<50)
{
entity head, newgoal = world;
float distance, bestdistance = 0;
for (head = findchain(classname, "waypoint"); head; head = head.chain)
{
- distance = vlen(head.origin - self.origin);
+ distance = vlen(head.origin - this.origin);
if(distance>1000)
continue;
- traceline(self.origin + self.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), true, world);
+ traceline(this.origin + this.view_ofs , ( ( head.absmin + head.absmax ) * 0.5 ), true, world);
if(trace_fraction<1)
continue;
if(newgoal)
{
- self.ignoregoal = self.goalcurrent;
- self.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
- navigation_clearroute();
- navigation_routetogoal(newgoal, self.origin);
- self.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
+ this.ignoregoal = this.goalcurrent;
+ this.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
+ navigation_clearroute(this);
+ navigation_routetogoal(this, newgoal, this.origin);
+ this.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
}
}
else
}
else
{
- if(self.velocity.z>0)
+ if(this.velocity.z>0)
{
- float threshold, sxy;
- vector velxy = self.velocity; velxy_z = 0;
- sxy = vlen(velxy);
+ float threshold;
+ vector velxy = this.velocity; velxy_z = 0;
threshold = maxspeed * 0.2;
- if(sxy < threshold)
+ if(vdist(velxy, <, threshold))
{
- LOG_TRACE("Warning: ", self.netname, " got stuck on a jumppad (velocity in xy is ", ftos(sxy), "), trying to get out of it now\n");
- self.aistatus |= AI_STATUS_OUT_JUMPPAD;
+ LOG_TRACE("Warning: ", this.netname, " got stuck on a jumppad (velocity in xy is ", vtos(velxy), "), trying to get out of it now\n");
+ this.aistatus |= AI_STATUS_OUT_JUMPPAD;
}
return;
}
// Don't chase players while using a jump pad
- if(IS_PLAYER(self.goalcurrent) || IS_PLAYER(self.goalstack01))
+ if(IS_PLAYER(this.goalcurrent) || IS_PLAYER(this.goalstack01))
return;
}
}
- else if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
- self.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
+ else if(this.aistatus & AI_STATUS_OUT_JUMPPAD)
+ this.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
// If there is a trigger_hurt right below try to use the jetpack or make a rocketjump
if(skill>6)
- if (!(IS_ONGROUND(self)))
+ if (!(IS_ONGROUND(this)))
{
- tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 -65536', MOVE_NOMONSTERS, self);
- if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos ))
- if(self.items & IT_JETPACK)
+ tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 -65536', MOVE_NOMONSTERS, this);
+ if(tracebox_hits_trigger_hurt(this.origin, this.mins, this.maxs, trace_endpos ))
+ if(this.items & IT_JETPACK)
{
- tracebox(self.origin, self.mins, self.maxs, self.origin + '0 0 65536', MOVE_NOMONSTERS, self);
- if(tracebox_hits_trigger_hurt(self.origin, self.mins, self.maxs, trace_endpos + '0 0 1' ))
+ tracebox(this.origin, this.mins, this.maxs, this.origin + '0 0 65536', MOVE_NOMONSTERS, this);
+ if(tracebox_hits_trigger_hurt(this.origin, this.mins, this.maxs, trace_endpos + '0 0 1' ))
{
- if(self.velocity.z<0)
+ if(this.velocity.z<0)
{
- PHYS_INPUT_BUTTON_HOOK(self) = true;
+ PHYS_INPUT_BUTTON_HOOK(this) = true;
}
}
else
- PHYS_INPUT_BUTTON_HOOK(self) = true;
+ PHYS_INPUT_BUTTON_HOOK(this) = true;
// If there is no goal try to move forward
- if(self.goalcurrent==world)
+ if(this.goalcurrent==world)
dir = v_forward;
else
- dir = normalize(( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - self.origin);
+ dir = normalize(( ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5 ) - this.origin);
- vector xyvelocity = self.velocity; xyvelocity_z = 0;
+ vector xyvelocity = this.velocity; xyvelocity_z = 0;
float xyspeed = xyvelocity * dir;
if(xyspeed < (maxspeed / 2))
{
- makevectors(self.v_angle.y * '0 1 0');
- tracebox(self.origin, self.mins, self.maxs, self.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, self);
+ makevectors(this.v_angle.y * '0 1 0');
+ tracebox(this.origin, this.mins, this.maxs, this.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, this);
if(trace_fraction==1)
{
- self.movement_x = dir * v_forward * maxspeed;
- self.movement_y = dir * v_right * maxspeed;
+ this.movement_x = dir * v_forward * maxspeed;
+ this.movement_y = dir * v_right * maxspeed;
if (skill < 10)
- havocbot_keyboard_movement(self.origin + dir * 100);
+ havocbot_keyboard_movement(this, this.origin + dir * 100);
}
}
- self.havocbot_blockhead = true;
+ this.havocbot_blockhead = true;
return;
}
- else if(self.health>WEP_CVAR(devastator, damage)*0.5)
+ else if(this.health>WEP_CVAR(devastator, damage)*0.5)
{
- if(self.velocity.z < 0)
- if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
+ if(this.velocity.z < 0)
+ if(client_hasweapon(this, WEP_DEVASTATOR, true, false))
{
- self.movement_x = maxspeed;
+ this.movement_x = maxspeed;
- if(self.rocketjumptime)
+ if(this.rocketjumptime)
{
- if(time > self.rocketjumptime)
+ if(time > this.rocketjumptime)
{
- PHYS_INPUT_BUTTON_ATCK2(self) = true;
- self.rocketjumptime = 0;
+ PHYS_INPUT_BUTTON_ATCK2(this) = true;
+ this.rocketjumptime = 0;
}
return;
}
- PS(self).m_switchweapon = WEP_DEVASTATOR;
- self.v_angle_x = 90;
- PHYS_INPUT_BUTTON_ATCK(self) = true;
- self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
+ PS(this).m_switchweapon = WEP_DEVASTATOR;
+ this.v_angle_x = 90;
+ PHYS_INPUT_BUTTON_ATCK(this) = true;
+ this.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
return;
}
}
else
{
// If there is no goal try to move forward
- if(self.goalcurrent==world)
- self.movement_x = maxspeed;
+ if(this.goalcurrent==world)
+ this.movement_x = maxspeed;
}
}
// If we are under water with no goals, swim up
- if(self.waterlevel)
- if(self.goalcurrent==world)
+ if(this.waterlevel)
+ if(this.goalcurrent==world)
{
dir = '0 0 0';
- if(self.waterlevel>WATERLEVEL_SWIMMING)
+ if(this.waterlevel>WATERLEVEL_SWIMMING)
dir.z = 1;
- else if(self.velocity.z >= 0 && !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER))
- PHYS_INPUT_BUTTON_JUMP(self) = true;
+ else if(this.velocity.z >= 0 && !(this.waterlevel == WATERLEVEL_WETFEET && this.watertype == CONTENT_WATER))
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
else
- PHYS_INPUT_BUTTON_JUMP(self) = false;
- makevectors(self.v_angle.y * '0 1 0');
- self.movement_x = dir * v_forward * maxspeed;
- self.movement_y = dir * v_right * maxspeed;
- self.movement_z = dir * v_up * maxspeed;
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
+ makevectors(this.v_angle.y * '0 1 0');
+ this.movement_x = dir * v_forward * maxspeed;
+ this.movement_y = dir * v_right * maxspeed;
+ this.movement_z = dir * v_up * maxspeed;
}
// if there is nowhere to go, exit
- if (self.goalcurrent == world)
+ if (this.goalcurrent == world)
return;
- if (self.goalcurrent)
- navigation_poptouchedgoals();
+ if (this.goalcurrent)
+ navigation_poptouchedgoals(this);
// if ran out of goals try to use an alternative goal or get a new strategy asap
- if(self.goalcurrent == world)
+ if(this.goalcurrent == world)
{
- self.bot_strategytime = 0;
+ this.bot_strategytime = 0;
return;
}
if(autocvar_bot_debug_goalstack)
- debuggoalstack();
+ debuggoalstack(this);
- m1 = self.goalcurrent.origin + self.goalcurrent.mins;
- m2 = self.goalcurrent.origin + self.goalcurrent.maxs;
- destorg = self.origin;
+ m1 = this.goalcurrent.origin + this.goalcurrent.mins;
+ m2 = this.goalcurrent.origin + this.goalcurrent.maxs;
+ destorg = this.origin;
destorg.x = bound(m1_x, destorg.x, m2_x);
destorg.y = bound(m1_y, destorg.y, m2_y);
destorg.z = bound(m1_z, destorg.z, m2_z);
- diff = destorg - self.origin;
+ diff = destorg - this.origin;
//dist = vlen(diff);
dir = normalize(diff);
flatdir = diff;flatdir.z = 0;
flatdir = normalize(flatdir);
- gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
+ gco = (this.goalcurrent.absmin + this.goalcurrent.absmax) * 0.5;
- //if (self.bot_dodgevector_time < time)
+ //if (this.bot_dodgevector_time < time)
{
- // self.bot_dodgevector_time = time + cvar("bot_ai_dodgeupdateinterval");
- // self.bot_dodgevector_jumpbutton = 1;
+ // this.bot_dodgevector_time = time + cvar("bot_ai_dodgeupdateinterval");
+ // this.bot_dodgevector_jumpbutton = 1;
evadeobstacle = '0 0 0';
evadelava = '0 0 0';
- if (self.waterlevel)
+ if (this.waterlevel)
{
- if(self.waterlevel>WATERLEVEL_SWIMMING)
+ if(this.waterlevel>WATERLEVEL_SWIMMING)
{
// flatdir_z = 1;
- self.aistatus |= AI_STATUS_OUT_WATER;
+ this.aistatus |= AI_STATUS_OUT_WATER;
}
else
{
- if(self.velocity.z >= 0 && !(self.watertype == CONTENT_WATER && gco.z < self.origin.z) &&
- ( !(self.waterlevel == WATERLEVEL_WETFEET && self.watertype == CONTENT_WATER) || self.aistatus & AI_STATUS_OUT_WATER))
- PHYS_INPUT_BUTTON_JUMP(self) = true;
+ if(this.velocity.z >= 0 && !(this.watertype == CONTENT_WATER && gco.z < this.origin.z) &&
+ ( !(this.waterlevel == WATERLEVEL_WETFEET && this.watertype == CONTENT_WATER) || this.aistatus & AI_STATUS_OUT_WATER))
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
else
- PHYS_INPUT_BUTTON_JUMP(self) = false;
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
}
dir = normalize(flatdir);
- makevectors(self.v_angle.y * '0 1 0');
+ makevectors(this.v_angle.y * '0 1 0');
}
else
{
- if(self.aistatus & AI_STATUS_OUT_WATER)
- self.aistatus &= ~AI_STATUS_OUT_WATER;
+ if(this.aistatus & AI_STATUS_OUT_WATER)
+ this.aistatus &= ~AI_STATUS_OUT_WATER;
// jump if going toward an obstacle that doesn't look like stairs we
// can walk up directly
- tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.2, false, self);
+ tracebox(this.origin, this.mins, this.maxs, this.origin + this.velocity * 0.2, false, this);
if (trace_fraction < 1)
if (trace_plane_normal.z < 0.7)
{
s = trace_fraction;
- tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, false, self);
+ tracebox(this.origin + stepheightvec, this.mins, this.maxs, this.origin + this.velocity * 0.2 + stepheightvec, false, this);
if (trace_fraction < s + 0.01)
if (trace_plane_normal.z < 0.7)
{
s = trace_fraction;
- tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, false, self);
+ tracebox(this.origin + jumpstepheightvec, this.mins, this.maxs, this.origin + this.velocity * 0.2 + jumpstepheightvec, false, this);
if (trace_fraction > s)
- PHYS_INPUT_BUTTON_JUMP(self) = true;
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
}
}
// avoiding dangers and obstacles
vector dst_ahead, dst_down;
- makevectors(self.v_angle.y * '0 1 0');
- dst_ahead = self.origin + self.view_ofs + (self.velocity * 0.4) + (v_forward * 32 * 3);
+ makevectors(this.v_angle.y * '0 1 0');
+ dst_ahead = this.origin + this.view_ofs + (this.velocity * 0.4) + (v_forward * 32 * 3);
dst_down = dst_ahead - '0 0 1500';
// Look ahead
- traceline(self.origin + self.view_ofs, dst_ahead, true, world);
+ traceline(this.origin + this.view_ofs, dst_ahead, true, world);
// Check head-banging against walls
- if(vlen(self.origin + self.view_ofs - trace_endpos) < 25 && !(self.aistatus & AI_STATUS_OUT_WATER))
+ if(vlen(this.origin + this.view_ofs - trace_endpos) < 25 && !(this.aistatus & AI_STATUS_OUT_WATER))
{
- PHYS_INPUT_BUTTON_JUMP(self) = true;
- if(self.facingwalltime && time > self.facingwalltime)
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
+ if(this.facingwalltime && time > this.facingwalltime)
{
- self.ignoregoal = self.goalcurrent;
- self.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
- self.bot_strategytime = 0;
+ this.ignoregoal = this.goalcurrent;
+ this.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
+ this.bot_strategytime = 0;
return;
}
else
{
- self.facingwalltime = time + 0.05;
+ this.facingwalltime = time + 0.05;
}
}
else
{
- self.facingwalltime = 0;
+ this.facingwalltime = 0;
- if(self.ignoregoal != world && time > self.ignoregoaltime)
+ if(this.ignoregoal != world && time > this.ignoregoaltime)
{
- self.ignoregoal = world;
- self.ignoregoaltime = 0;
+ this.ignoregoal = world;
+ this.ignoregoaltime = 0;
}
}
// Check for water/slime/lava and dangerous edges
// (only when the bot is on the ground or jumping intentionally)
- self.aistatus &= ~AI_STATUS_DANGER_AHEAD;
+ this.aistatus &= ~AI_STATUS_DANGER_AHEAD;
- if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
- if((IS_ONGROUND(self)) || (self.aistatus & AI_STATUS_RUNNING) || PHYS_INPUT_BUTTON_JUMP(self))
+ if(trace_fraction == 1 && this.jumppadcount == 0 && !this.goalcurrent.wphardwired )
+ if((IS_ONGROUND(this)) || (this.aistatus & AI_STATUS_RUNNING) || PHYS_INPUT_BUTTON_JUMP(this))
{
// Look downwards
traceline(dst_ahead , dst_down, true, world);
- // te_lightning2(world, self.origin, dst_ahead); // Draw "ahead" look
+ // te_lightning2(world, this.origin, dst_ahead); // Draw "ahead" look
// te_lightning2(world, dst_ahead, dst_down); // Draw "downwards" look
- if(trace_endpos.z < self.origin.z + self.mins.z)
+ if(trace_endpos.z < this.origin.z + this.mins.z)
{
s = pointcontents(trace_endpos + '0 0 1');
if (s != CONTENT_SOLID)
if (s == CONTENT_LAVA || s == CONTENT_SLIME)
- evadelava = normalize(self.velocity) * -1;
+ evadelava = normalize(this.velocity) * -1;
else if (s == CONTENT_SKY)
- evadeobstacle = normalize(self.velocity) * -1;
- else if (!boxesoverlap(dst_ahead - self.view_ofs + self.mins, dst_ahead - self.view_ofs + self.maxs,
- self.goalcurrent.absmin, self.goalcurrent.absmax))
+ evadeobstacle = normalize(this.velocity) * -1;
+ else if (!boxesoverlap(dst_ahead - this.view_ofs + this.mins, dst_ahead - this.view_ofs + this.maxs,
+ this.goalcurrent.absmin, this.goalcurrent.absmax))
{
// if ain't a safe goal with "holes" (like the jumpad on soylent)
// and there is a trigger_hurt below
- if(tracebox_hits_trigger_hurt(dst_ahead, self.mins, self.maxs, trace_endpos))
+ if(tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos))
{
// Remove dangerous dynamic goals from stack
- LOG_TRACE("bot ", self.netname, " avoided the goal ", self.goalcurrent.classname, " ", etos(self.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
- navigation_clearroute();
+ LOG_TRACE("bot ", this.netname, " avoided the goal ", this.goalcurrent.classname, " ", etos(this.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
+ navigation_clearroute(this);
return;
}
}
dir = flatdir;
evadeobstacle.z = 0;
evadelava.z = 0;
- makevectors(self.v_angle.y * '0 1 0');
+ makevectors(this.v_angle.y * '0 1 0');
if(evadeobstacle!='0 0 0'||evadelava!='0 0 0')
- self.aistatus |= AI_STATUS_DANGER_AHEAD;
+ this.aistatus |= AI_STATUS_DANGER_AHEAD;
}
dodge = havocbot_dodge();
- dodge = dodge * bound(0,0.5+(skill+self.bot_dodgeskill)*0.1,1);
- evadelava = evadelava * bound(1,3-(skill+self.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
- traceline(self.origin, ( ( self.enemy.absmin + self.enemy.absmax ) * 0.5 ), true, world);
+ dodge = dodge * bound(0,0.5+(skill+this.bot_dodgeskill)*0.1,1);
+ evadelava = evadelava * bound(1,3-(skill+this.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
+ traceline(this.origin, ( ( this.enemy.absmin + this.enemy.absmax ) * 0.5 ), true, world);
if(IS_PLAYER(trace_ent))
- dir = dir * bound(0,(skill+self.bot_dodgeskill)/7,1);
+ dir = dir * bound(0,(skill+this.bot_dodgeskill)/7,1);
dir = normalize(dir + dodge + evadeobstacle + evadelava);
- // self.bot_dodgevector = dir;
- // self.bot_dodgevector_jumpbutton = PHYS_INPUT_BUTTON_JUMP(self);
+ // this.bot_dodgevector = dir;
+ // this.bot_dodgevector_jumpbutton = PHYS_INPUT_BUTTON_JUMP(this);
}
- if(time < self.ladder_time)
+ if(time < this.ladder_time)
{
- if(self.goalcurrent.origin.z + self.goalcurrent.mins.z > self.origin.z + self.mins.z)
+ if(this.goalcurrent.origin.z + this.goalcurrent.mins.z > this.origin.z + this.mins.z)
{
- if(self.origin.z + self.mins.z < self.ladder_entity.origin.z + self.ladder_entity.maxs.z)
+ if(this.origin.z + this.mins.z < this.ladder_entity.origin.z + this.ladder_entity.maxs.z)
dir.z = 1;
}
else
{
- if(self.origin.z + self.mins.z > self.ladder_entity.origin.z + self.ladder_entity.mins.z)
+ if(this.origin.z + this.mins.z > this.ladder_entity.origin.z + this.ladder_entity.mins.z)
dir.z = -1;
}
}
- //dir = self.bot_dodgevector;
- //if (self.bot_dodgevector_jumpbutton)
- // PHYS_INPUT_BUTTON_JUMP(self) = true;
- self.movement_x = dir * v_forward * maxspeed;
- self.movement_y = dir * v_right * maxspeed;
- self.movement_z = dir * v_up * maxspeed;
+ //dir = this.bot_dodgevector;
+ //if (this.bot_dodgevector_jumpbutton)
+ // PHYS_INPUT_BUTTON_JUMP(this) = true;
+ this.movement_x = dir * v_forward * maxspeed;
+ this.movement_y = dir * v_right * maxspeed;
+ this.movement_z = dir * v_up * maxspeed;
// Emulate keyboard interface
if (skill < 10)
- havocbot_keyboard_movement(destorg);
+ havocbot_keyboard_movement(this, destorg);
// Bunnyhop!
-// if(self.aistatus & AI_STATUS_ROAMING)
- if(self.goalcurrent)
- if(skill+self.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
- havocbot_bunnyhop(dir);
-
- if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(self))) PHYS_INPUT_BUTTON_JUMP(self) = true;
- if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) PHYS_INPUT_BUTTON_JUMP(self) = true;
- if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-self.bot_dodgeskill)*0.1,1)) self.havocbot_ducktime=time+0.3/bound(0.1,skill+self.bot_dodgeskill,10);
+// if(this.aistatus & AI_STATUS_ROAMING)
+ if(this.goalcurrent)
+ if(skill+this.bot_moveskill >= autocvar_bot_ai_bunnyhop_skilloffset)
+ havocbot_bunnyhop(this, dir);
+
+ if ((dir * v_up) >= autocvar_sv_jumpvelocity*0.5 && (IS_ONGROUND(this))) PHYS_INPUT_BUTTON_JUMP(this) = true;
+ if (((dodge * v_up) > 0) && random()*frametime >= 0.2*bound(0,(10-skill-this.bot_dodgeskill)*0.1,1)) PHYS_INPUT_BUTTON_JUMP(this) = true;
+ if (((dodge * v_up) < 0) && random()*frametime >= 0.5*bound(0,(10-skill-this.bot_dodgeskill)*0.1,1)) this.havocbot_ducktime=time+0.3/bound(0.1,skill+this.bot_dodgeskill,10);
}
-void havocbot_chooseenemy()
-{SELFPARAM();
+void havocbot_chooseenemy(entity this)
+{
entity head, best, head2;
float rating, bestrating, hf;
vector eye, v;
- if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
+ if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
{
- self.enemy = world;
+ this.enemy = world;
return;
}
- if (self.enemy)
+ if (this.enemy)
{
- if (!bot_shouldattack(self.enemy))
+ if (!bot_shouldattack(this, this.enemy))
{
// enemy died or something, find a new target
- self.enemy = world;
- self.havocbot_chooseenemy_finished = time;
+ this.enemy = world;
+ this.havocbot_chooseenemy_finished = time;
}
- else if (self.havocbot_stickenemy)
+ else if (this.havocbot_stickenemy)
{
// tracking last chosen enemy
// if enemy is visible
// and not really really far away
// and we're not severely injured
// then keep tracking for a half second into the future
- traceline(self.origin+self.view_ofs, ( self.enemy.absmin + self.enemy.absmax ) * 0.5,false,world);
- if (trace_ent == self.enemy || trace_fraction == 1)
- if (vlen((( self.enemy.absmin + self.enemy.absmax ) * 0.5) - self.origin) < 1000)
- if (self.health > 30)
+ traceline(this.origin+this.view_ofs, ( this.enemy.absmin + this.enemy.absmax ) * 0.5,false,world);
+ if (trace_ent == this.enemy || trace_fraction == 1)
+ if (vdist(((this.enemy.absmin + this.enemy.absmax) * 0.5) - this.origin, <, 1000))
+ if (this.health > 30)
{
// remain tracking him for a shot while (case he went after a small corner or pilar
- self.havocbot_chooseenemy_finished = time + 0.5;
+ this.havocbot_chooseenemy_finished = time + 0.5;
return;
}
// enemy isn't visible, or is far away, or we're injured severely
// so stop preferring this enemy
// (it will still take a half second until a new one is chosen)
- self.havocbot_stickenemy = 0;
+ this.havocbot_stickenemy = 0;
}
}
- if (time < self.havocbot_chooseenemy_finished)
+ if (time < this.havocbot_chooseenemy_finished)
return;
- self.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
- eye = self.origin + self.view_ofs;
+ this.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
+ eye = this.origin + this.view_ofs;
best = world;
bestrating = 100000000;
head = head2 = findchainfloat(bot_attack, true);
// Backup hit flags
- hf = self.dphitcontentsmask;
+ hf = this.dphitcontentsmask;
// Search for enemies, if no enemy can be seen directly try to look through transparent objects
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
bool scan_transparent = false;
bool scan_secondary_targets = false;
while(true)
{
scan_secondary_targets = false;
- :scan_targets
+LABEL(scan_targets)
for( ; head; head = head.chain)
{
if(!scan_secondary_targets)
rating = vlen(v - eye);
if (rating<autocvar_bot_ai_enemydetectionradius)
if (bestrating > rating)
- if (bot_shouldattack(head))
+ if (bot_shouldattack(this, head))
{
- traceline(eye, v, true, self);
+ traceline(eye, v, true, this);
if (trace_ent == head || trace_fraction >= 1)
{
best = head;
// I want to do a second scan if no enemy was found or I don't have weapons
// TODO: Perform the scan when using the rifle (requires changes on the rifle code)
- if(best || self.weapons) // || self.weapon == WEP_RIFLE.m_id
+ if(best || this.weapons) // || this.weapon == WEP_RIFLE.m_id
break;
if(scan_transparent)
break;
// Set flags to see through transparent objects
- self.dphitcontentsmask |= DPCONTENTS_OPAQUE;
+ this.dphitcontentsmask |= DPCONTENTS_OPAQUE;
head = head2;
scan_transparent = true;
}
// Restore hit flags
- self.dphitcontentsmask = hf;
+ this.dphitcontentsmask = hf;
- self.enemy = best;
- self.havocbot_stickenemy = true;
+ this.enemy = best;
+ this.havocbot_stickenemy = true;
if(best && best.classname == "misc_breakablemodel")
- self.havocbot_stickenemy = false;
+ this.havocbot_stickenemy = false;
}
-float havocbot_chooseweapon_checkreload(int new_weapon)
-{SELFPARAM();
+float havocbot_chooseweapon_checkreload(entity this, int new_weapon)
+{
// bots under this skill cannot find unloaded weapons to reload idly when not in combat,
// so skip this for them, or they'll never get to reload their weapons at all.
// this also allows bots under this skill to be more stupid, and reload more often during combat :)
return false;
// if this weapon is scheduled for reloading, don't switch to it during combat
- if (self.weapon_load[new_weapon] < 0)
+ if (this.weapon_load[new_weapon] < 0)
{
bool other_weapon_available = false;
FOREACH(Weapons, it != WEP_Null, LAMBDA(
return false;
}
-void havocbot_chooseweapon()
-{SELFPARAM();
+void havocbot_chooseweapon(entity this)
+{
int i;
// ;)
if(g_weaponarena_weapons == WEPSET(TUBA))
{
- PS(self).m_switchweapon = WEP_TUBA;
+ PS(this).m_switchweapon = WEP_TUBA;
return;
}
// TODO: clean this up by moving it to weapon code
- if(self.enemy==world)
+ if(this.enemy==world)
{
// If no weapon was chosen get the first available weapon
- if(PS(self).m_weapon==WEP_Null)
+ if(PS(this).m_weapon==WEP_Null)
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if(client_hasweapon(self, it, true, false))
+ if(client_hasweapon(this, it, true, false))
{
- PS(self).m_switchweapon = it;
+ PS(this).m_switchweapon = it;
return;
}
));
}
// Do not change weapon during the next second after a combo
- float f = time - self.lastcombotime;
+ float f = time - this.lastcombotime;
if(f < 1)
return;
float w;
- float distance; distance=bound(10,vlen(self.origin-self.enemy.origin)-200,10000);
+ float distance; distance=bound(10,vlen(this.origin-this.enemy.origin)-200,10000);
// Should it do a weapon combo?
float af, ct, combo_time, combo;
- af = ATTACK_FINISHED(self, 0);
+ af = ATTACK_FINISHED(this, 0);
ct = autocvar_bot_ai_weapon_combo_threshold;
// Bots with no skill will be 4 times more slower than "godlike" bots when doing weapon combos
// Ideally this 4 should be calculated as longest_weapon_refire / bot_ai_weapon_combo_threshold
- combo_time = time + ct + (ct * ((-0.3*(skill+self.bot_weaponskill))+3));
+ combo_time = time + ct + (ct * ((-0.3*(skill+this.bot_weaponskill))+3));
combo = false;
if(autocvar_bot_ai_weapon_combo)
- if(PS(self).m_weapon.m_id == self.lastfiredweapon)
+ if(PS(this).m_weapon.m_id == this.lastfiredweapon)
if(af > combo_time)
{
combo = true;
- self.lastcombotime = time;
+ this.lastcombotime = time;
}
- distance *= pow(2, self.bot_rangepreference);
+ distance *= pow(2, this.bot_rangepreference);
// Custom weapon list based on distance to the enemy
if(bot_custom_weapon){
if ( distance > bot_distance_far ) {
for(i=0; i < Weapons_COUNT && bot_weapons_far[i] != -1 ; ++i){
w = bot_weapons_far[i];
- if ( client_hasweapon(self, Weapons_from(w), true, false) )
+ if ( client_hasweapon(this, Weapons_from(w), true, false) )
{
- if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
+ if ((PS(this).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, w))
continue;
- PS(self).m_switchweapon = Weapons_from(w);
+ PS(this).m_switchweapon = Weapons_from(w);
return;
}
}
if ( distance > bot_distance_close) {
for(i=0; i < Weapons_COUNT && bot_weapons_mid[i] != -1 ; ++i){
w = bot_weapons_mid[i];
- if ( client_hasweapon(self, Weapons_from(w), true, false) )
+ if ( client_hasweapon(this, Weapons_from(w), true, false) )
{
- if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
+ if ((PS(this).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, w))
continue;
- PS(self).m_switchweapon = Weapons_from(w);
+ PS(this).m_switchweapon = Weapons_from(w);
return;
}
}
// Choose weapons for close distance
for(i=0; i < Weapons_COUNT && bot_weapons_close[i] != -1 ; ++i){
w = bot_weapons_close[i];
- if ( client_hasweapon(self, Weapons_from(w), true, false) )
+ if ( client_hasweapon(this, Weapons_from(w), true, false) )
{
- if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
+ if ((PS(this).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, w))
continue;
- PS(self).m_switchweapon = Weapons_from(w);
+ PS(this).m_switchweapon = Weapons_from(w);
return;
}
}
}
}
-void havocbot_aim()
-{SELFPARAM();
+void havocbot_aim(entity this)
+{
vector selfvel, enemyvel;
-// if(self.flags & FL_INWATER)
+// if(this.flags & FL_INWATER)
// return;
- if (time < self.nextaim)
+ if (time < this.nextaim)
return;
- self.nextaim = time + 0.1;
- selfvel = self.velocity;
- if (!self.waterlevel)
+ this.nextaim = time + 0.1;
+ selfvel = this.velocity;
+ if (!this.waterlevel)
selfvel.z = 0;
- if (self.enemy)
+ if (this.enemy)
{
- enemyvel = self.enemy.velocity;
- if (!self.enemy.waterlevel)
+ enemyvel = this.enemy.velocity;
+ if (!this.enemy.waterlevel)
enemyvel.z = 0;
- lag_additem(time + self.ping, 0, 0, self.enemy, self.origin, selfvel, (self.enemy.absmin + self.enemy.absmax) * 0.5, enemyvel);
+ lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, selfvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel);
}
else
- lag_additem(time + self.ping, 0, 0, world, self.origin, selfvel, ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5, '0 0 0');
+ lag_additem(this, time + this.ping, 0, 0, world, this.origin, selfvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0');
}
-float havocbot_moveto_refresh_route()
-{SELFPARAM();
+bool havocbot_moveto_refresh_route(entity this)
+{
// Refresh path to goal if necessary
entity wp;
- wp = self.havocbot_personal_waypoint;
- navigation_goalrating_start();
- navigation_routerating(wp, 10000, 10000);
- navigation_goalrating_end();
- return self.navigation_hasgoals;
+ wp = this.havocbot_personal_waypoint;
+ navigation_goalrating_start(this);
+ navigation_routerating(this, wp, 10000, 10000);
+ navigation_goalrating_end(this);
+ return this.navigation_hasgoals;
}
-float havocbot_moveto(vector pos)
-{SELFPARAM();
+float havocbot_moveto(entity this, vector pos)
+{
entity wp;
- if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+ if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
{
// Step 4: Move to waypoint
- if(self.havocbot_personal_waypoint==world)
+ if(this.havocbot_personal_waypoint==world)
{
- LOG_TRACE("Error: ", self.netname, " trying to walk to a non existent personal waypoint\n");
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+ LOG_TRACE("Error: ", this.netname, " trying to walk to a non existent personal waypoint\n");
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
return CMD_STATUS_ERROR;
}
if (!bot_strategytoken_taken)
- if(self.havocbot_personal_waypoint_searchtime<time)
+ if(this.havocbot_personal_waypoint_searchtime<time)
{
bot_strategytoken_taken = true;
- if(havocbot_moveto_refresh_route())
+ if(havocbot_moveto_refresh_route(this))
{
- LOG_TRACE(self.netname, " walking to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
- self.havocbot_personal_waypoint_searchtime = time + 10;
- self.havocbot_personal_waypoint_failcounter = 0;
+ LOG_TRACE(this.netname, " walking to its personal waypoint (after ", ftos(this.havocbot_personal_waypoint_failcounter), " failed attempts)\n");
+ this.havocbot_personal_waypoint_searchtime = time + 10;
+ this.havocbot_personal_waypoint_failcounter = 0;
}
else
{
- self.havocbot_personal_waypoint_failcounter += 1;
- self.havocbot_personal_waypoint_searchtime = time + 2;
- if(self.havocbot_personal_waypoint_failcounter >= 30)
+ this.havocbot_personal_waypoint_failcounter += 1;
+ this.havocbot_personal_waypoint_searchtime = time + 2;
+ if(this.havocbot_personal_waypoint_failcounter >= 30)
{
- LOG_TRACE("Warning: can't walk to the personal waypoint located at ", vtos(self.havocbot_personal_waypoint.origin),"\n");
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
- remove(self.havocbot_personal_waypoint);
+ LOG_TRACE("Warning: can't walk to the personal waypoint located at ", vtos(this.havocbot_personal_waypoint.origin),"\n");
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
+ remove(this.havocbot_personal_waypoint);
return CMD_STATUS_ERROR;
}
else
- LOG_TRACE(self.netname, " can't walk to its personal waypoint (after ", ftos(self.havocbot_personal_waypoint_failcounter), " failed attempts), trying later\n");
+ LOG_TRACE(this.netname, " can't walk to its personal waypoint (after ", ftos(this.havocbot_personal_waypoint_failcounter), " failed attempts), trying later\n");
}
}
if(autocvar_bot_debug_goalstack)
- debuggoalstack();
+ debuggoalstack(this);
// Heading
- vector dir = ( ( self.goalcurrent.absmin + self.goalcurrent.absmax ) * 0.5 ) - (self.origin + self.view_ofs);
+ vector dir = ( ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5 ) - (this.origin + this.view_ofs);
dir.z = 0;
- bot_aimdir(dir, -1);
+ bot_aimdir(this, dir, -1);
// Go!
- havocbot_movetogoal();
+ havocbot_movetogoal(this);
- if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_REACHED)
+ if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_REACHED)
{
// Step 5: Waypoint reached
- LOG_TRACE(self.netname, "'s personal waypoint reached\n");
- remove(self.havocbot_personal_waypoint);
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+ LOG_TRACE(this.netname, "'s personal waypoint reached\n");
+ remove(this.havocbot_personal_waypoint);
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_REACHED;
return CMD_STATUS_FINISHED;
}
}
// Step 2: Linking waypoint
- if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_LINKING)
+ if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_LINKING)
{
// Wait until it is linked
- if(!self.havocbot_personal_waypoint.wplinked)
+ if(!this.havocbot_personal_waypoint.wplinked)
{
- LOG_TRACE(self.netname, " waiting for personal waypoint to be linked\n");
+ LOG_TRACE(this.netname, " waiting for personal waypoint to be linked\n");
return CMD_STATUS_EXECUTING;
}
- self.havocbot_personal_waypoint_searchtime = time; // so we set the route next frame
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
- self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_GOING;
+ this.havocbot_personal_waypoint_searchtime = time; // so we set the route next frame
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_LINKING;
+ this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_GOING;
// Step 3: Route to waypoint
- LOG_TRACE(self.netname, " walking to its personal waypoint\n");
+ LOG_TRACE(this.netname, " walking to its personal waypoint\n");
return CMD_STATUS_EXECUTING;
}
// Step 1: Spawning waypoint
- wp = waypoint_spawnpersonal(pos);
+ wp = waypoint_spawnpersonal(this, pos);
if(wp==world)
{
LOG_TRACE("Error: Can't spawn personal waypoint at ",vtos(pos),"\n");
return CMD_STATUS_ERROR;
}
- self.havocbot_personal_waypoint = wp;
- self.havocbot_personal_waypoint_failcounter = 0;
- self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_LINKING;
+ this.havocbot_personal_waypoint = wp;
+ this.havocbot_personal_waypoint_failcounter = 0;
+ this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_LINKING;
// if pos is inside a teleport, then let's mark it as teleport waypoint
entity head;
if(WarpZoneLib_BoxTouchesBrush(pos, pos, head, world))
{
wp.wpflags |= WAYPOINTFLAG_TELEPORT;
- self.lastteleporttime = 0;
+ this.lastteleporttime = 0;
}
}
return CMD_STATUS_EXECUTING;
}
-float havocbot_resetgoal()
+float havocbot_resetgoal(entity this)
{
- navigation_clearroute();
+ navigation_clearroute(this);
return CMD_STATUS_FINISHED;
}
-void havocbot_setupbot()
-{SELFPARAM();
- self.bot_ai = havocbot_ai;
- self.cmd_moveto = havocbot_moveto;
- self.cmd_resetgoal = havocbot_resetgoal;
+void havocbot_setupbot(entity this)
+{
+ this.bot_ai = havocbot_ai;
+ this.cmd_moveto = havocbot_moveto;
+ this.cmd_resetgoal = havocbot_resetgoal;
- havocbot_chooserole();
+ havocbot_chooserole(this);
}
vector havocbot_dodge()
-{SELFPARAM();
+{
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0
-#ifndef HAVOCBOT_H
-#define HAVOCBOT_H
+#pragma once
/*
* Globals and Fields
* Functions
*/
-void havocbot_ai();
-void havocbot_aim();
-void havocbot_setupbot();
-void havocbot_movetogoal();
-void havocbot_chooserole();
-void havocbot_chooseenemy();
-void havocbot_chooseweapon();
-void havocbot_bunnyhop(vector dir);
-void havocbot_keyboard_movement(vector destorg);
+void havocbot_ai(entity this);
+void havocbot_aim(entity this);
+void havocbot_setupbot(entity this);
+void havocbot_movetogoal(entity this);
+void havocbot_chooserole(entity this);
+void havocbot_chooseenemy(entity this);
+void havocbot_chooseweapon(entity this);
+void havocbot_bunnyhop(entity this, vector dir);
+void havocbot_keyboard_movement(entity this, vector destorg);
-float havocbot_resetgoal();
-float havocbot_moveto(vector pos);
-float havocbot_moveto_refresh_route();
+float havocbot_resetgoal(entity this);
+float havocbot_moveto(entity this, vector pos);
+float havocbot_moveto_refresh_route(entity this);
vector havocbot_dodge();
-.void() havocbot_role;
-.void() havocbot_previous_role;
+.void(entity this) havocbot_role;
+.void(entity this) havocbot_previous_role;
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_items;
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
/*
* Imports
.entity draggedby;
.float ladder_time;
.entity ladder_entity;
-#endif
+#include "roles.qh"
#include "havocbot.qh"
.float max_armorvalue;
.float havocbot_role_timeout;
-.void() havocbot_previous_role;
-.void() havocbot_role;
+.void(entity this) havocbot_previous_role;
+.void(entity this) havocbot_role;
-void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_items(entity this, float ratingscale, vector org, float sradius)
+{
entity head;
float rating, d, discard, distance, friend_distance, enemy_distance;
vector o;
friend_distance = 10000; enemy_distance = 10000;
rating = 0;
- if(!head.solid || distance > sradius || (head == self.ignoregoal && time < self.ignoregoaltime) )
+ if(!head.solid || distance > sradius || (head == this.ignoregoal && time < this.ignoregoaltime) )
{
head = head.chain;
continue;
{
discard = false;
- FOREACH_CLIENT(IS_PLAYER(it) && it != self && !IS_DEAD(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this && !IS_DEAD(it), LAMBDA(
d = vlen(it.origin - o); // distance between player and item
- if ( it.team == self.team )
+ if ( it.team == this.team )
{
if ( !IS_REAL_CLIENT(it) || discard )
continue;
discard = true;
- if( head.health && it.health > self.health )
+ if( head.health && it.health > this.health )
continue;
- if( head.armorvalue && it.armorvalue > self.armorvalue)
+ if( head.armorvalue && it.armorvalue > this.armorvalue)
continue;
if( head.weapons )
if( head.weapons & ~it.weapons )
continue;
- if (head.ammo_shells && it.ammo_shells > self.ammo_shells)
+ if (head.ammo_shells && it.ammo_shells > this.ammo_shells)
continue;
- if (head.ammo_nails && it.ammo_nails > self.ammo_nails)
+ if (head.ammo_nails && it.ammo_nails > this.ammo_nails)
continue;
- if (head.ammo_rockets && it.ammo_rockets > self.ammo_rockets)
+ if (head.ammo_rockets && it.ammo_rockets > this.ammo_rockets)
continue;
- if (head.ammo_cells && it.ammo_cells > self.ammo_cells)
+ if (head.ammo_cells && it.ammo_cells > this.ammo_cells)
continue;
- if (head.ammo_plasma && it.ammo_plasma > self.ammo_plasma)
+ if (head.ammo_plasma && it.ammo_plasma > this.ammo_plasma)
continue;
discard = false;
// Rate the item only if no one needs it, or if an enemy is closer to it
if ( (enemy_distance < friend_distance && distance < enemy_distance) ||
(friend_distance > autocvar_bot_ai_friends_aware_pickup_radius ) || !discard )
- rating = head.bot_pickupevalfunc(self, head);
+ rating = head.bot_pickupevalfunc(this, head);
}
else
- rating = head.bot_pickupevalfunc(self, head);
+ rating = head.bot_pickupevalfunc(this, head);
if(rating > 0)
- navigation_routerating(head, rating * ratingscale, 2000);
+ navigation_routerating(this, head, rating * ratingscale, 2000);
head = head.chain;
}
}
-void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_controlpoints(entity this, float ratingscale, vector org, float sradius)
+{
entity head;
head = findchain(classname, "dom_controlpoint");
while (head)
{
- if (vlen(( ( head.absmin + head.absmax ) * 0.5 ) - org) < sradius)
+ if(vdist((((head.absmin + head.absmax) * 0.5) - org), <, sradius))
{
if(head.cnt > -1) // this is just being fought for
- navigation_routerating(head, ratingscale, 5000);
+ navigation_routerating(this, head, ratingscale, 5000);
else if(head.goalentity.cnt == 0) // unclaimed point
- navigation_routerating(head, ratingscale * 0.5, 5000);
- else if(head.goalentity.team != self.team) // other team's point
- navigation_routerating(head, ratingscale * 0.2, 5000);
+ navigation_routerating(this, head, ratingscale * 0.5, 5000);
+ else if(head.goalentity.team != this.team) // other team's point
+ navigation_routerating(this, head, ratingscale * 0.2, 5000);
}
head = head.chain;
}
}
-void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org, float sradius)
+{
if (autocvar_bot_nofire)
return;
// don't chase players if we're under water
- if(self.waterlevel>WATERLEVEL_WETFEET)
+ if(this.waterlevel>WATERLEVEL_WETFEET)
return;
- float distance;
int t;
- FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && bot_shouldattack(this, it), LAMBDA(
// TODO: Merge this logic with the bot_shouldattack function
- distance = vlen(it.origin - org);
- if (distance < 100 || distance > sradius)
+ if(vdist(it.origin - org, <, 100) || vdist(it.origin - org, >, sradius))
continue;
// rate only visible enemies
/*
- traceline(self.origin + self.view_ofs, it.origin, MOVE_NOMONSTERS, self);
+ traceline(this.origin + this.view_ofs, it.origin, MOVE_NOMONSTERS, this);
if (trace_fraction < 1 || trace_ent != it)
continue;
*/
continue;
}
- // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
+ // TODO: rate waypoints near the targetted player at that moment, instead of the player itthis
// adding a player as a goal seems to be quite dangerous, especially on space maps
// remove hack in navigation_poptouchedgoals() after performing this change
- t = (self.health + self.armorvalue ) / (it.health + it.armorvalue );
- navigation_routerating(it, t * ratingscale, 2000);
+ t = (this.health + this.armorvalue ) / (it.health + it.armorvalue );
+ navigation_routerating(this, it, t * ratingscale, 2000);
));
}
// legacy bot role for standard gamemodes
// go to best items
-void havocbot_role_generic()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_generic(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_items(10000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
- //havocbot_goalrating_waypoints(1, self.origin, 1000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_items(this, 10000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 20000, this.origin, 10000);
+ //havocbot_goalrating_waypoints(1, this.origin, 1000);
+ navigation_goalrating_end(this);
}
}
-void havocbot_chooserole_generic()
-{SELFPARAM();
- self.havocbot_role = havocbot_role_generic;
+void havocbot_chooserole_generic(entity this)
+{
+ this.havocbot_role = havocbot_role_generic;
}
-void havocbot_chooserole()
-{SELFPARAM();
+void havocbot_chooserole(entity this)
+{
LOG_TRACE("choosing a role...\n");
- self.bot_strategytime = 0;
- if(!MUTATOR_CALLHOOK(HavocBot_ChooseRole, self))
- havocbot_chooserole_generic();
+ this.bot_strategytime = 0;
+ if(!MUTATOR_CALLHOOK(HavocBot_ChooseRole, this))
+ havocbot_chooserole_generic(this);
}
-#ifndef ROLES_H
-#define ROLES_H
-void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius);
-#endif
+#pragma once
+void havocbot_goalrating_controlpoints(entity this, float ratingscale, vector org, float sradius);
-#ifndef HAVOCBOT_SCRIPTING_H
-#define HAVOCBOT_SCRIPTING_H
+#pragma once
void bot_clearqueue(entity bot);
-#endif
if(autocvar_bot_debug_tracewalk)
{
debugresetnodes();
- debugnode(start);
+ debugnode(self, start);
}
move = end - start;
return true;
}
if(autocvar_bot_debug_tracewalk)
- debugnode(org);
+ debugnode(self, org);
if (dist <= 0)
break;
tracebox(org, m1, m2, org + move * stepdist, movemode, e);
if(autocvar_bot_debug_tracewalk)
- debugnode(trace_endpos);
+ debugnode(self, trace_endpos);
if (trace_fraction < 1)
{
for (; org.z < end.z + self.maxs.z; org.z += stepdist)
{
if(autocvar_bot_debug_tracewalk)
- debugnode(org);
+ debugnode(self, org);
if(pointcontents(org) == CONTENT_EMPTY)
break;
tracebox(org, m1, m2, move, movemode, e);
if(autocvar_bot_debug_tracewalk)
- debugnode(trace_endpos);
+ debugnode(self, trace_endpos);
// hit something
if (trace_fraction < 1)
/////////////////////////////////////////////////////////////////////////////
// completely empty the goal stack, used when deciding where to go
-void navigation_clearroute()
-{SELFPARAM();
- //print("bot ", etos(self), " clear\n");
- self.navigation_hasgoals = false;
- self.goalcurrent = world;
- self.goalstack01 = world;
- self.goalstack02 = world;
- self.goalstack03 = world;
- self.goalstack04 = world;
- self.goalstack05 = world;
- self.goalstack06 = world;
- self.goalstack07 = world;
- self.goalstack08 = world;
- self.goalstack09 = world;
- self.goalstack10 = world;
- self.goalstack11 = world;
- self.goalstack12 = world;
- self.goalstack13 = world;
- self.goalstack14 = world;
- self.goalstack15 = world;
- self.goalstack16 = world;
- self.goalstack17 = world;
- self.goalstack18 = world;
- self.goalstack19 = world;
- self.goalstack20 = world;
- self.goalstack21 = world;
- self.goalstack22 = world;
- self.goalstack23 = world;
- self.goalstack24 = world;
- self.goalstack25 = world;
- self.goalstack26 = world;
- self.goalstack27 = world;
- self.goalstack28 = world;
- self.goalstack29 = world;
- self.goalstack30 = world;
- self.goalstack31 = world;
+void navigation_clearroute(entity this)
+{
+ //print("bot ", etos(this), " clear\n");
+ this.navigation_hasgoals = false;
+ this.goalcurrent = world;
+ this.goalstack01 = world;
+ this.goalstack02 = world;
+ this.goalstack03 = world;
+ this.goalstack04 = world;
+ this.goalstack05 = world;
+ this.goalstack06 = world;
+ this.goalstack07 = world;
+ this.goalstack08 = world;
+ this.goalstack09 = world;
+ this.goalstack10 = world;
+ this.goalstack11 = world;
+ this.goalstack12 = world;
+ this.goalstack13 = world;
+ this.goalstack14 = world;
+ this.goalstack15 = world;
+ this.goalstack16 = world;
+ this.goalstack17 = world;
+ this.goalstack18 = world;
+ this.goalstack19 = world;
+ this.goalstack20 = world;
+ this.goalstack21 = world;
+ this.goalstack22 = world;
+ this.goalstack23 = world;
+ this.goalstack24 = world;
+ this.goalstack25 = world;
+ this.goalstack26 = world;
+ this.goalstack27 = world;
+ this.goalstack28 = world;
+ this.goalstack29 = world;
+ this.goalstack30 = world;
+ this.goalstack31 = world;
}
// add a new goal at the beginning of the stack
// next-closest WP on the shortest path to the WP
// That means, if the stack overflows, the bot will know how to do the FIRST 32
// steps to the goal, and then recalculate the path.
-void navigation_pushroute(entity e)
-{SELFPARAM();
- //print("bot ", etos(self), " push ", etos(e), "\n");
- self.goalstack31 = self.goalstack30;
- self.goalstack30 = self.goalstack29;
- self.goalstack29 = self.goalstack28;
- self.goalstack28 = self.goalstack27;
- self.goalstack27 = self.goalstack26;
- self.goalstack26 = self.goalstack25;
- self.goalstack25 = self.goalstack24;
- self.goalstack24 = self.goalstack23;
- self.goalstack23 = self.goalstack22;
- self.goalstack22 = self.goalstack21;
- self.goalstack21 = self.goalstack20;
- self.goalstack20 = self.goalstack19;
- self.goalstack19 = self.goalstack18;
- self.goalstack18 = self.goalstack17;
- self.goalstack17 = self.goalstack16;
- self.goalstack16 = self.goalstack15;
- self.goalstack15 = self.goalstack14;
- self.goalstack14 = self.goalstack13;
- self.goalstack13 = self.goalstack12;
- self.goalstack12 = self.goalstack11;
- self.goalstack11 = self.goalstack10;
- self.goalstack10 = self.goalstack09;
- self.goalstack09 = self.goalstack08;
- self.goalstack08 = self.goalstack07;
- self.goalstack07 = self.goalstack06;
- self.goalstack06 = self.goalstack05;
- self.goalstack05 = self.goalstack04;
- self.goalstack04 = self.goalstack03;
- self.goalstack03 = self.goalstack02;
- self.goalstack02 = self.goalstack01;
- self.goalstack01 = self.goalcurrent;
- self.goalcurrent = e;
+void navigation_pushroute(entity this, entity e)
+{
+ //print("bot ", etos(this), " push ", etos(e), "\n");
+ this.goalstack31 = this.goalstack30;
+ this.goalstack30 = this.goalstack29;
+ this.goalstack29 = this.goalstack28;
+ this.goalstack28 = this.goalstack27;
+ this.goalstack27 = this.goalstack26;
+ this.goalstack26 = this.goalstack25;
+ this.goalstack25 = this.goalstack24;
+ this.goalstack24 = this.goalstack23;
+ this.goalstack23 = this.goalstack22;
+ this.goalstack22 = this.goalstack21;
+ this.goalstack21 = this.goalstack20;
+ this.goalstack20 = this.goalstack19;
+ this.goalstack19 = this.goalstack18;
+ this.goalstack18 = this.goalstack17;
+ this.goalstack17 = this.goalstack16;
+ this.goalstack16 = this.goalstack15;
+ this.goalstack15 = this.goalstack14;
+ this.goalstack14 = this.goalstack13;
+ this.goalstack13 = this.goalstack12;
+ this.goalstack12 = this.goalstack11;
+ this.goalstack11 = this.goalstack10;
+ this.goalstack10 = this.goalstack09;
+ this.goalstack09 = this.goalstack08;
+ this.goalstack08 = this.goalstack07;
+ this.goalstack07 = this.goalstack06;
+ this.goalstack06 = this.goalstack05;
+ this.goalstack05 = this.goalstack04;
+ this.goalstack04 = this.goalstack03;
+ this.goalstack03 = this.goalstack02;
+ this.goalstack02 = this.goalstack01;
+ this.goalstack01 = this.goalcurrent;
+ this.goalcurrent = e;
}
// remove first goal from stack
// (in other words: remove a prerequisite for reaching the later goals)
// (used when a spawnfunc_waypoint is reached)
-void navigation_poproute()
-{SELFPARAM();
- //print("bot ", etos(self), " pop\n");
- self.goalcurrent = self.goalstack01;
- self.goalstack01 = self.goalstack02;
- self.goalstack02 = self.goalstack03;
- self.goalstack03 = self.goalstack04;
- self.goalstack04 = self.goalstack05;
- self.goalstack05 = self.goalstack06;
- self.goalstack06 = self.goalstack07;
- self.goalstack07 = self.goalstack08;
- self.goalstack08 = self.goalstack09;
- self.goalstack09 = self.goalstack10;
- self.goalstack10 = self.goalstack11;
- self.goalstack11 = self.goalstack12;
- self.goalstack12 = self.goalstack13;
- self.goalstack13 = self.goalstack14;
- self.goalstack14 = self.goalstack15;
- self.goalstack15 = self.goalstack16;
- self.goalstack16 = self.goalstack17;
- self.goalstack17 = self.goalstack18;
- self.goalstack18 = self.goalstack19;
- self.goalstack19 = self.goalstack20;
- self.goalstack20 = self.goalstack21;
- self.goalstack21 = self.goalstack22;
- self.goalstack22 = self.goalstack23;
- self.goalstack23 = self.goalstack24;
- self.goalstack24 = self.goalstack25;
- self.goalstack25 = self.goalstack26;
- self.goalstack26 = self.goalstack27;
- self.goalstack27 = self.goalstack28;
- self.goalstack28 = self.goalstack29;
- self.goalstack29 = self.goalstack30;
- self.goalstack30 = self.goalstack31;
- self.goalstack31 = world;
+void navigation_poproute(entity this)
+{
+ //print("bot ", etos(this), " pop\n");
+ this.goalcurrent = this.goalstack01;
+ this.goalstack01 = this.goalstack02;
+ this.goalstack02 = this.goalstack03;
+ this.goalstack03 = this.goalstack04;
+ this.goalstack04 = this.goalstack05;
+ this.goalstack05 = this.goalstack06;
+ this.goalstack06 = this.goalstack07;
+ this.goalstack07 = this.goalstack08;
+ this.goalstack08 = this.goalstack09;
+ this.goalstack09 = this.goalstack10;
+ this.goalstack10 = this.goalstack11;
+ this.goalstack11 = this.goalstack12;
+ this.goalstack12 = this.goalstack13;
+ this.goalstack13 = this.goalstack14;
+ this.goalstack14 = this.goalstack15;
+ this.goalstack15 = this.goalstack16;
+ this.goalstack16 = this.goalstack17;
+ this.goalstack17 = this.goalstack18;
+ this.goalstack18 = this.goalstack19;
+ this.goalstack19 = this.goalstack20;
+ this.goalstack20 = this.goalstack21;
+ this.goalstack21 = this.goalstack22;
+ this.goalstack22 = this.goalstack23;
+ this.goalstack23 = this.goalstack24;
+ this.goalstack24 = this.goalstack25;
+ this.goalstack25 = this.goalstack26;
+ this.goalstack26 = this.goalstack27;
+ this.goalstack27 = this.goalstack28;
+ this.goalstack28 = this.goalstack29;
+ this.goalstack29 = this.goalstack30;
+ this.goalstack30 = this.goalstack31;
+ this.goalstack31 = world;
}
float navigation_waypoint_will_link(vector v, vector org, entity ent, float walkfromwp, float bestdist)
}
// finds the waypoints near the bot initiating a navigation query
-float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
-{SELFPARAM();
+float navigation_markroutes_nearestwaypoints(entity this, entity waylist, float maxdist)
+{
entity head;
vector v, m1, m2, diff;
float c;
{
m1 = head.origin + head.mins;
m2 = head.origin + head.maxs;
- v = self.origin;
+ v = this.origin;
v.x = bound(m1_x, v.x, m2_x);
v.y = bound(m1_y, v.y, m2_y);
v.z = bound(m1_z, v.z, m2_z);
}
else
v = head.origin;
- diff = v - self.origin;
+ diff = v - this.origin;
diff.z = max(0, diff.z);
- if (vlen(diff) < maxdist)
+ if(vdist(diff, <, maxdist))
{
head.wpconsidered = true;
- if (tracewalk(self, self.origin, self.mins, self.maxs, v, bot_navigation_movemode))
+ entity oldself = self;
+ setself(this);
+ if (tracewalk(this, this.origin, this.mins, this.maxs, v, bot_navigation_movemode))
{
head.wpnearestpoint = v;
- head.wpcost = vlen(v - self.origin) + head.dmg;
+ head.wpcost = vlen(v - this.origin) + head.dmg;
head.wpfire = 1;
head.enemy = world;
c = c + 1;
}
+ setself(oldself);
}
}
head = head.chain;
}
// queries the entire spawnfunc_waypoint network for pathes leading away from the bot
-void navigation_markroutes(entity fixed_source_waypoint)
-{SELFPARAM();
+void navigation_markroutes(entity this, entity fixed_source_waypoint)
+{
entity w, wp, waylist;
float searching, cost, cost2;
vector p;
// try a short range search for the nearest waypoints, and expand the search repeatedly if none are found
// as this search is expensive we will use lower values if the bot is on the air
float i, increment, maxdistance;
- if(IS_ONGROUND(self))
+ if(IS_ONGROUND(this))
{
increment = 750;
maxdistance = 50000;
maxdistance = 1500;
}
- for(i=increment;!navigation_markroutes_nearestwaypoints(waylist, i)&&i<maxdistance;i+=increment);
+ for(i=increment;!navigation_markroutes_nearestwaypoints(this, waylist, i)&&i<maxdistance;i+=increment);
}
searching = true;
}
// updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item
-void navigation_routerating(entity e, float f, float rangebias)
-{SELFPARAM();
+void navigation_routerating(entity this, entity e, float f, float rangebias)
+{
entity nwp;
vector o;
if (!e)
// Evaluate path using jetpack
if(g_jetpack)
- if(self.items & IT_JETPACK)
+ if(this.items & IT_JETPACK)
if(autocvar_bot_ai_navigation_jetpack)
- if(vlen(self.origin - o) > autocvar_bot_ai_navigation_jetpack_mindistance)
+ if(vlen(this.origin - o) > autocvar_bot_ai_navigation_jetpack_mindistance)
{
vector pointa, pointb;
LOG_DEBUG("jetpack ai: evaluating path for ", e.classname, "\n");
// Point A
- traceline(self.origin, self.origin + '0 0 65535', MOVE_NORMAL, self);
+ traceline(this.origin, this.origin + '0 0 65535', MOVE_NORMAL, this);
pointa = trace_endpos - '0 0 1';
// Point B
pointb = trace_endpos - '0 0 1';
// Can I see these two points from the sky?
- traceline(pointa, pointb, MOVE_NORMAL, self);
+ traceline(pointa, pointb, MOVE_NORMAL, this);
if(trace_fraction==1)
{
npa = pointa + down;
npb = pointb + down;
- if(npa.z<=self.absmax.z)
+ if(npa.z<=this.absmax.z)
break;
if(npb.z<=e.absmax.z)
break;
- traceline(npa, npb, MOVE_NORMAL, self);
+ traceline(npa, npb, MOVE_NORMAL, this);
if(trace_fraction==1)
{
pointa = npa;
// Rough estimation of fuel consumption
// (ignores acceleration and current xyz velocity)
xydistance = vlen(pointa - pointb);
- zdistance = fabs(pointa.z - self.origin.z);
+ zdistance = fabs(pointa.z - this.origin.z);
t = zdistance / autocvar_g_jetpack_maxspeed_up;
t += xydistance / autocvar_g_jetpack_maxspeed_side;
fuel = t * autocvar_g_jetpack_fuel * 0.8;
- LOG_DEBUG(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
+ LOG_DEBUG(strcat("jetpack ai: required fuel ", ftos(fuel), " this.ammo_fuel ", ftos(this.ammo_fuel), "\n"));
// enough fuel ?
- if(self.ammo_fuel>fuel)
+ if(this.ammo_fuel>fuel)
{
// Estimate cost
// (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship
LOG_DEBUG(strcat("jetpack path: added goal ", e.classname, " (with rating ", ftos(f), ")\n"));
navigation_bestrating = f;
navigation_bestgoal = e;
- self.navigation_jetpack_goal = e;
- self.navigation_jetpack_point = pointb;
+ this.navigation_jetpack_goal = e;
+ this.navigation_jetpack_point = pointb;
}
return;
}
}
// adds an item to the the goal stack with the path to a given item
-float navigation_routetogoal(entity e, vector startposition)
-{SELFPARAM();
- self.goalentity = e;
+bool navigation_routetogoal(entity this, entity e, vector startposition)
+{
+ this.goalentity = e;
// if there is no goal, just exit
if (!e)
return false;
- self.navigation_hasgoals = true;
+ this.navigation_hasgoals = true;
// put the entity on the goal stack
//print("routetogoal ", etos(e), "\n");
- navigation_pushroute(e);
+ navigation_pushroute(this, e);
if(g_jetpack)
- if(e==self.navigation_jetpack_goal)
+ if(e==this.navigation_jetpack_goal)
return true;
// if it can reach the goal there is nothing more to do
- if (tracewalk(self, startposition, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
+ if (tracewalk(this, startposition, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), (e.absmin + e.absmax) * 0.5, bot_navigation_movemode))
return true;
// see if there are waypoints describing a path to the item
for (;;)
{
// add the spawnfunc_waypoint to the path
- navigation_pushroute(e);
+ navigation_pushroute(this, e);
e = e.enemy;
if(e==world)
// removes any currently touching waypoints from the goal stack
// (this is how bots detect if they reached a goal)
-void navigation_poptouchedgoals()
-{SELFPARAM();
+void navigation_poptouchedgoals(entity this)
+{
vector org, m1, m2;
- org = self.origin;
- m1 = org + self.mins;
- m2 = org + self.maxs;
+ org = this.origin;
+ m1 = org + this.mins;
+ m2 = org + this.maxs;
- if(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
+ if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
{
- if(self.lastteleporttime>0)
- if(time-self.lastteleporttime<(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)?2:0.15)
+ if(this.lastteleporttime>0)
+ if(time-this.lastteleporttime<(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL)?2:0.15)
{
- if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
- if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
+ if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+ if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
{
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
- self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+ this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
}
- navigation_poproute();
+ navigation_poproute(this);
return;
}
}
// If for some reason the bot is closer to the next goal, pop the current one
- if(self.goalstack01)
- if(vlen(self.goalcurrent.origin - self.origin) > vlen(self.goalstack01.origin - self.origin))
- if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
- if(tracewalk(self, self.origin, self.mins, self.maxs, (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5, bot_navigation_movemode))
+ if(this.goalstack01)
+ if(vlen(this.goalcurrent.origin - this.origin) > vlen(this.goalstack01.origin - this.origin))
+ if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
+ if(tracewalk(this, this.origin, this.mins, this.maxs, (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5, bot_navigation_movemode))
{
- LOG_DEBUG(strcat("path optimized for ", self.netname, ", removed a goal from the queue\n"));
- navigation_poproute();
+ LOG_DEBUG(strcat("path optimized for ", this.netname, ", removed a goal from the queue\n"));
+ navigation_poproute(this);
// TODO this may also be a nice idea to do "early" (e.g. by
// manipulating the vlen() comparisons) to shorten paths in
// general - this would make bots walk more "on rails" than
}
// HACK: remove players/bots as goals, they can lead a bot to unexpected places (cliffs, lava, etc)
- // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
- if(IS_PLAYER(self.goalcurrent))
- navigation_poproute();
+ // TODO: rate waypoints near the targetted player at that moment, instead of the player itthis
+ if(IS_PLAYER(this.goalcurrent))
+ navigation_poproute(this);
// aid for detecting jump pads better (distance based check fails sometimes)
- if(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && self.jumppadcount > 0 )
- navigation_poproute();
+ if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && this.jumppadcount > 0 )
+ navigation_poproute(this);
// Loose goal touching check when running
- if(self.aistatus & AI_STATUS_RUNNING)
- if(self.speed >= autocvar_sv_maxspeed) // if -really- running
- if(self.goalcurrent.classname=="waypoint")
+ if(this.aistatus & AI_STATUS_RUNNING)
+ if(this.speed >= autocvar_sv_maxspeed) // if -really- running
+ if(this.goalcurrent.classname=="waypoint")
{
- if(vlen(self.origin - self.goalcurrent.origin)<150)
+ if(vlen(this.origin - this.goalcurrent.origin)<150)
{
- traceline(self.origin + self.view_ofs , self.goalcurrent.origin, true, world);
+ traceline(this.origin + this.view_ofs , this.goalcurrent.origin, true, world);
if(trace_fraction==1)
{
// Detect personal waypoints
- if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
- if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
+ if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+ if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
{
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
- self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+ this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
}
- navigation_poproute();
+ navigation_poproute(this);
}
}
}
- while (self.goalcurrent && boxesoverlap(m1, m2, self.goalcurrent.absmin, self.goalcurrent.absmax))
+ while (this.goalcurrent && boxesoverlap(m1, m2, this.goalcurrent.absmin, this.goalcurrent.absmax))
{
// Detect personal waypoints
- if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
- if(self.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && self.goalcurrent.owner==self)
+ if(this.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
+ if(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL && this.goalcurrent.owner==this)
{
- self.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
- self.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
+ this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
+ this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
}
- navigation_poproute();
+ navigation_poproute(this);
}
}
// begin a goal selection session (queries spawnfunc_waypoint network)
-void navigation_goalrating_start()
-{SELFPARAM();
- if(self.aistatus & AI_STATUS_STUCK)
+void navigation_goalrating_start(entity this)
+{
+ if(this.aistatus & AI_STATUS_STUCK)
return;
- self.navigation_jetpack_goal = world;
+ this.navigation_jetpack_goal = world;
navigation_bestrating = -1;
- self.navigation_hasgoals = false;
- navigation_clearroute();
+ this.navigation_hasgoals = false;
+ navigation_clearroute(this);
navigation_bestgoal = world;
- navigation_markroutes(world);
+ navigation_markroutes(this, world);
}
// ends a goal selection session (updates goal stack to the best goal)
-void navigation_goalrating_end()
-{SELFPARAM();
- if(self.aistatus & AI_STATUS_STUCK)
+void navigation_goalrating_end(entity this)
+{
+ if(this.aistatus & AI_STATUS_STUCK)
return;
- navigation_routetogoal(navigation_bestgoal, self.origin);
- LOG_DEBUG(strcat("best goal ", self.goalcurrent.classname , "\n"));
+ navigation_routetogoal(this, navigation_bestgoal, this.origin);
+ LOG_DEBUG(strcat("best goal ", this.goalcurrent.classname , "\n"));
// If the bot got stuck then try to reach the farthest waypoint
- if (!self.navigation_hasgoals)
+ if (!this.navigation_hasgoals)
if (autocvar_bot_wander_enable)
{
- if (!(self.aistatus & AI_STATUS_STUCK))
+ if (!(this.aistatus & AI_STATUS_STUCK))
{
- LOG_DEBUG(strcat(self.netname, " cannot walk to any goal\n"));
- self.aistatus |= AI_STATUS_STUCK;
+ LOG_DEBUG(strcat(this.netname, " cannot walk to any goal\n"));
+ this.aistatus |= AI_STATUS_STUCK;
}
- self.navigation_hasgoals = false; // Reset this value
+ this.navigation_hasgoals = false; // Reset this value
}
}
}
}
-void navigation_unstuck()
-{SELFPARAM();
+void navigation_unstuck(entity this)
+{
float search_radius = 1000;
if (!autocvar_bot_wander_enable)
if (!bot_waypoint_queue_owner)
{
- LOG_DEBUG(strcat(self.netname, " sutck, taking over the waypoints queue\n"));
- bot_waypoint_queue_owner = self;
+ LOG_DEBUG(strcat(this.netname, " sutck, taking over the waypoints queue\n"));
+ bot_waypoint_queue_owner = this;
bot_waypoint_queue_bestgoal = world;
bot_waypoint_queue_bestgoalrating = 0;
}
- if(bot_waypoint_queue_owner!=self)
+ if(bot_waypoint_queue_owner!=this)
return;
if (bot_waypoint_queue_goal)
{
// evaluate the next goal on the queue
- float d = vlen(self.origin - bot_waypoint_queue_goal.origin);
- LOG_DEBUG(strcat(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n"));
- if(tracewalk(bot_waypoint_queue_goal, self.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
+ float d = vlen(this.origin - bot_waypoint_queue_goal.origin);
+ LOG_DEBUG(strcat(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n"));
+ entity oldself = self;
+ setself(this); // tracewalk has questionable use of self
+ if(tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), bot_waypoint_queue_goal.origin, bot_navigation_movemode))
{
if( d > bot_waypoint_queue_bestgoalrating)
{
bot_waypoint_queue_bestgoal = bot_waypoint_queue_goal;
}
}
+ setself(oldself);
bot_waypoint_queue_goal = bot_waypoint_queue_goal.bot_waypoint_queue_nextgoal;
if (!bot_waypoint_queue_goal)
{
if (bot_waypoint_queue_bestgoal)
{
- LOG_DEBUG(strcat(self.netname, " stuck, reachable waypoint found, heading to it\n"));
- navigation_routetogoal(bot_waypoint_queue_bestgoal, self.origin);
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- self.aistatus &= ~AI_STATUS_STUCK;
+ LOG_DEBUG(strcat(this.netname, " stuck, reachable waypoint found, heading to it\n"));
+ navigation_routetogoal(this, bot_waypoint_queue_bestgoal, this.origin);
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.aistatus &= ~AI_STATUS_STUCK;
}
else
{
- LOG_DEBUG(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
+ LOG_DEBUG(strcat(this.netname, " stuck, cannot walk to any waypoint at all\n"));
}
bot_waypoint_queue_owner = world;
}
else
{
- if(bot_strategytoken!=self)
+ if(bot_strategytoken!=this)
return;
// build a new queue
- LOG_DEBUG(strcat(self.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n"));
+ LOG_DEBUG(strcat(this.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n"));
entity head, first;
first = world;
- head = findradius(self.origin, search_radius);
+ head = findradius(this.origin, search_radius);
while(head)
{
bot_waypoint_queue_goal = first;
else
{
- LOG_DEBUG(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
+ LOG_DEBUG(strcat(this.netname, " stuck, cannot walk to any waypoint at all\n"));
bot_waypoint_queue_owner = world;
}
}
debuglastnode = '0 0 0';
}
-void debugnode(vector node)
-{SELFPARAM();
- if (!IS_PLAYER(self))
+void debugnode(entity this, vector node)
+{
+ if (!IS_PLAYER(this))
return;
if(debuglastnode=='0 0 0')
.vector lastposition;
// Debug the goal stack visually
-void debuggoalstack()
-{SELFPARAM();
+void debuggoalstack(entity this)
+{
entity goal;
vector org, go;
- if(self.goalcounter==0)goal=self.goalcurrent;
- else if(self.goalcounter==1)goal=self.goalstack01;
- else if(self.goalcounter==2)goal=self.goalstack02;
- else if(self.goalcounter==3)goal=self.goalstack03;
- else if(self.goalcounter==4)goal=self.goalstack04;
- else if(self.goalcounter==5)goal=self.goalstack05;
- else if(self.goalcounter==6)goal=self.goalstack06;
- else if(self.goalcounter==7)goal=self.goalstack07;
- else if(self.goalcounter==8)goal=self.goalstack08;
- else if(self.goalcounter==9)goal=self.goalstack09;
- else if(self.goalcounter==10)goal=self.goalstack10;
- else if(self.goalcounter==11)goal=self.goalstack11;
- else if(self.goalcounter==12)goal=self.goalstack12;
- else if(self.goalcounter==13)goal=self.goalstack13;
- else if(self.goalcounter==14)goal=self.goalstack14;
- else if(self.goalcounter==15)goal=self.goalstack15;
- else if(self.goalcounter==16)goal=self.goalstack16;
- else if(self.goalcounter==17)goal=self.goalstack17;
- else if(self.goalcounter==18)goal=self.goalstack18;
- else if(self.goalcounter==19)goal=self.goalstack19;
- else if(self.goalcounter==20)goal=self.goalstack20;
- else if(self.goalcounter==21)goal=self.goalstack21;
- else if(self.goalcounter==22)goal=self.goalstack22;
- else if(self.goalcounter==23)goal=self.goalstack23;
- else if(self.goalcounter==24)goal=self.goalstack24;
- else if(self.goalcounter==25)goal=self.goalstack25;
- else if(self.goalcounter==26)goal=self.goalstack26;
- else if(self.goalcounter==27)goal=self.goalstack27;
- else if(self.goalcounter==28)goal=self.goalstack28;
- else if(self.goalcounter==29)goal=self.goalstack29;
- else if(self.goalcounter==30)goal=self.goalstack30;
- else if(self.goalcounter==31)goal=self.goalstack31;
+ if(this.goalcounter==0)goal=this.goalcurrent;
+ else if(this.goalcounter==1)goal=this.goalstack01;
+ else if(this.goalcounter==2)goal=this.goalstack02;
+ else if(this.goalcounter==3)goal=this.goalstack03;
+ else if(this.goalcounter==4)goal=this.goalstack04;
+ else if(this.goalcounter==5)goal=this.goalstack05;
+ else if(this.goalcounter==6)goal=this.goalstack06;
+ else if(this.goalcounter==7)goal=this.goalstack07;
+ else if(this.goalcounter==8)goal=this.goalstack08;
+ else if(this.goalcounter==9)goal=this.goalstack09;
+ else if(this.goalcounter==10)goal=this.goalstack10;
+ else if(this.goalcounter==11)goal=this.goalstack11;
+ else if(this.goalcounter==12)goal=this.goalstack12;
+ else if(this.goalcounter==13)goal=this.goalstack13;
+ else if(this.goalcounter==14)goal=this.goalstack14;
+ else if(this.goalcounter==15)goal=this.goalstack15;
+ else if(this.goalcounter==16)goal=this.goalstack16;
+ else if(this.goalcounter==17)goal=this.goalstack17;
+ else if(this.goalcounter==18)goal=this.goalstack18;
+ else if(this.goalcounter==19)goal=this.goalstack19;
+ else if(this.goalcounter==20)goal=this.goalstack20;
+ else if(this.goalcounter==21)goal=this.goalstack21;
+ else if(this.goalcounter==22)goal=this.goalstack22;
+ else if(this.goalcounter==23)goal=this.goalstack23;
+ else if(this.goalcounter==24)goal=this.goalstack24;
+ else if(this.goalcounter==25)goal=this.goalstack25;
+ else if(this.goalcounter==26)goal=this.goalstack26;
+ else if(this.goalcounter==27)goal=this.goalstack27;
+ else if(this.goalcounter==28)goal=this.goalstack28;
+ else if(this.goalcounter==29)goal=this.goalstack29;
+ else if(this.goalcounter==30)goal=this.goalstack30;
+ else if(this.goalcounter==31)goal=this.goalstack31;
else goal=world;
if(goal==world)
{
- self.goalcounter = 0;
- self.lastposition='0 0 0';
+ this.goalcounter = 0;
+ this.lastposition='0 0 0';
return;
}
- if(self.lastposition=='0 0 0')
- org = self.origin;
+ if(this.lastposition=='0 0 0')
+ org = this.origin;
else
- org = self.lastposition;
+ org = this.lastposition;
go = ( goal.absmin + goal.absmax ) * 0.5;
te_lightning2(world, org, go);
- self.lastposition = go;
+ this.lastposition = go;
- self.goalcounter++;
+ this.goalcounter++;
}
-#ifndef NAVIGATION_H
-#define NAVIGATION_H
+#pragma once
/*
* Globals and Fields
*/
*/
void debugresetnodes();
-void debugnode(vector node);
+void debugnode(entity this, vector node);
void debugnodestatus(vector position, float status);
-void debuggoalstack();
+void debuggoalstack(entity this);
float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode);
-float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist);
-float navigation_routetogoal(entity e, vector startposition);
+float navigation_markroutes_nearestwaypoints(entity this, entity waylist, float maxdist);
+float navigation_routetogoal(entity this, entity e, vector startposition);
-void navigation_clearroute();
-void navigation_pushroute(entity e);
-void navigation_poproute();
+void navigation_clearroute(entity this);
+void navigation_pushroute(entity this, entity e);
+void navigation_poproute(entity this);
void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p);
-void navigation_markroutes(entity fixed_source_waypoint);
+void navigation_markroutes(entity this, entity fixed_source_waypoint);
void navigation_markroutes_inverted(entity fixed_source_waypoint);
-void navigation_routerating(entity e, float f, float rangebias);
-void navigation_poptouchedgoals();
-void navigation_goalrating_start();
-void navigation_goalrating_end();
-void navigation_unstuck();
+void navigation_routerating(entity this, entity e, float f, float rangebias);
+void navigation_poptouchedgoals(entity this);
+void navigation_goalrating_start(entity this);
+void navigation_goalrating_end(entity this);
+void navigation_unstuck(entity this);
void botframe_updatedangerousobjects(float maxupdate);
entity navigation_findnearestwaypoint(entity ent, float walkfromwp);
float navigation_waypoint_will_link(vector v, vector org, entity ent, float walkfromwp, float bestdist);
-#endif
#include "scripting.qh"
+#include <common/state.qh>
+#include <common/physics/player.qh>
+
#include "bot.qh"
.int state;
return bufstr_get(bot.bot_cmdqueuebuf, idx);
}
-float bot_havecommand(entity bot, float idx)
+bool bot_havecommand(entity this, int idx)
{
- if(!bot.bot_cmdqueuebuf_allocated)
- return 0;
- if(idx < bot.bot_cmdqueuebuf_start)
- return 0;
- if(idx >= bot.bot_cmdqueuebuf_end)
- return 0;
- return 1;
+ if(!this.bot_cmdqueuebuf_allocated)
+ return false;
+ if(idx < this.bot_cmdqueuebuf_start)
+ return false;
+ if(idx >= this.bot_cmdqueuebuf_end)
+ return false;
+ return true;
}
const int MAX_BOT_PLACES = 4;
.float bot_places_count;
.entity bot_places[MAX_BOT_PLACES];
.string bot_placenames[MAX_BOT_PLACES];
-entity bot_getplace(string placename)
-{SELFPARAM();
+entity bot_getplace(entity this, string placename)
+{
entity e;
if(substring(placename, 0, 1) == "@")
{
int i, p;
placename = substring(placename, 1, -1);
string s, s2;
- for(i = 0; i < self.bot_places_count; ++i)
- if(self.(bot_placenames[i]) == placename)
- return self.(bot_places[i]);
- // now: i == self.bot_places_count
+ for(i = 0; i < this.bot_places_count; ++i)
+ if(this.(bot_placenames[i]) == placename)
+ return this.(bot_places[i]);
+ // now: i == this.bot_places_count
s = s2 = cvar_string(placename);
p = strstrofs(s2, " ", 0);
if(p >= 0)
LOG_INFO("invalid place ", s, "\n");
if(i < MAX_BOT_PLACES)
{
- self.(bot_placenames[i]) = strzone(placename);
- self.(bot_places[i]) = e;
- self.bot_places_count += 1;
+ this.(bot_placenames[i]) = strzone(placename);
+ this.(bot_places[i]) = e;
+ this.bot_places_count += 1;
}
return e;
}
.int bot_exec_status;
void SV_ParseClientCommand(string s);
-float bot_cmd_cc()
+float bot_cmd_cc(entity this)
{
- SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string);
+ WITHSELF(this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
return CMD_STATUS_FINISHED;
}
-float bot_cmd_impulse()
-{SELFPARAM();
- self.impulse = bot_cmd.bot_cmd_parm_float;
+float bot_cmd_impulse(entity this)
+{
+ this.impulse = bot_cmd.bot_cmd_parm_float;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_continue()
-{SELFPARAM();
- self.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
+float bot_cmd_continue(entity this)
+{
+ this.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
return CMD_STATUS_FINISHED;
}
.float bot_cmd_wait_time;
-float bot_cmd_wait()
-{SELFPARAM();
- if(self.bot_exec_status & BOT_EXEC_STATUS_WAITING)
+float bot_cmd_wait(entity this)
+{
+ if(this.bot_exec_status & BOT_EXEC_STATUS_WAITING)
{
- if(time>=self.bot_cmd_wait_time)
+ if(time>=this.bot_cmd_wait_time)
{
- self.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
+ this.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
return CMD_STATUS_FINISHED;
}
else
return CMD_STATUS_EXECUTING;
}
- self.bot_cmd_wait_time = time + bot_cmd.bot_cmd_parm_float;
- self.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
+ this.bot_cmd_wait_time = time + bot_cmd.bot_cmd_parm_float;
+ this.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
return CMD_STATUS_EXECUTING;
}
-float bot_cmd_wait_until()
-{SELFPARAM();
+float bot_cmd_wait_until(entity this)
+{
if(time < bot_cmd.bot_cmd_parm_float + bot_barriertime)
{
- self.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
+ this.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
return CMD_STATUS_EXECUTING;
}
- self.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
+ this.bot_exec_status &= ~BOT_EXEC_STATUS_WAITING;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_barrier()
-{SELFPARAM();
+float bot_cmd_barrier(entity this)
+{
// 0 = no barrier, 1 = waiting, 2 = waiting finished
- if(self.bot_barrier == 0) // initialization
+ if(this.bot_barrier == 0) // initialization
{
- self.bot_barrier = 1;
+ this.bot_barrier = 1;
- //self.colormod = '4 4 0';
+ //this.colormod = '4 4 0';
}
- if(self.bot_barrier == 1) // find other bots
+ if(this.bot_barrier == 1) // find other bots
{
FOREACH_CLIENT(it.isbot, LAMBDA(
if(it.bot_cmdqueuebuf_allocated)
// if we get here, the barrier is finished
// so end it...
- self.bot_barrier = 0;
- //self.colormod = '0 0 0';
+ this.bot_barrier = 0;
+ //this.colormod = '0 0 0';
return CMD_STATUS_FINISHED;
}
-float bot_cmd_turn()
-{SELFPARAM();
- self.v_angle_y = self.v_angle.y + bot_cmd.bot_cmd_parm_float;
- self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
+float bot_cmd_turn(entity this)
+{
+ this.v_angle_y = this.v_angle.y + bot_cmd.bot_cmd_parm_float;
+ this.v_angle_y = this.v_angle.y - floor(this.v_angle.y / 360) * 360;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_select_weapon()
-{SELFPARAM();
+float bot_cmd_select_weapon(entity this)
+{
float id = bot_cmd.bot_cmd_parm_float;
if(id < WEP_FIRST || id > WEP_LAST)
return CMD_STATUS_ERROR;
- if(client_hasweapon(self, Weapons_from(id), true, false))
- PS(self).m_switchweapon = Weapons_from(id);
+ if(client_hasweapon(this, Weapons_from(id), true, false))
+ PS(this).m_switchweapon = Weapons_from(id);
else
return CMD_STATUS_ERROR;
const int CMD_CONDITION_true_BLOCK = 4;
const int CMD_CONDITION_false_BLOCK = 8;
-float bot_cmd_eval(string expr)
-{SELFPARAM();
+float bot_cmd_eval(entity this, string expr)
+{
// Search for numbers
if(strstrofs("0123456789", substring(expr, 0, 1), 0) >= 0)
{
switch(expr)
{
case "health":
- return self.health;
+ return this.health;
case "speed":
- return vlen(self.velocity);
+ return vlen(this.velocity);
case "flagcarrier":
- return ((self.flagcarried!=world));
+ return ((this.flagcarried!=world));
}
LOG_INFO(strcat("ERROR: Unable to convert the expression '",expr,"' into a numeric value\n"));
return 0;
}
-float bot_cmd_if()
-{SELFPARAM();
+float bot_cmd_if(entity this)
+{
string expr, val_a, val_b;
float cmpofs;
- if(self.bot_cmd_condition_status != CMD_CONDITION_NONE)
+ if(this.bot_cmd_condition_status != CMD_CONDITION_NONE)
{
// Only one "if" block is allowed at time
LOG_INFO("ERROR: Only one conditional block can be processed at time");
- bot_clearqueue(self);
+ bot_clearqueue(this);
return CMD_STATUS_ERROR;
}
- self.bot_cmd_condition_status |= CMD_CONDITION_true_BLOCK;
+ this.bot_cmd_condition_status |= CMD_CONDITION_true_BLOCK;
// search for operators
expr = bot_cmd.bot_cmd_parm_string;
val_a = substring(expr,0,cmpofs);
val_b = substring(expr,cmpofs+1,strlen(expr));
- if(bot_cmd_eval(val_a)==bot_cmd_eval(val_b))
- self.bot_cmd_condition_status |= CMD_CONDITION_true;
+ if(bot_cmd_eval(this, val_a)==bot_cmd_eval(this, val_b))
+ this.bot_cmd_condition_status |= CMD_CONDITION_true;
else
- self.bot_cmd_condition_status |= CMD_CONDITION_false;
+ this.bot_cmd_condition_status |= CMD_CONDITION_false;
return CMD_STATUS_FINISHED;
}
val_a = substring(expr,0,cmpofs);
val_b = substring(expr,cmpofs+1,strlen(expr));
- if(bot_cmd_eval(val_a)>bot_cmd_eval(val_b))
- self.bot_cmd_condition_status |= CMD_CONDITION_true;
+ if(bot_cmd_eval(this, val_a)>bot_cmd_eval(this, val_b))
+ this.bot_cmd_condition_status |= CMD_CONDITION_true;
else
- self.bot_cmd_condition_status |= CMD_CONDITION_false;
+ this.bot_cmd_condition_status |= CMD_CONDITION_false;
return CMD_STATUS_FINISHED;
}
val_a = substring(expr,0,cmpofs);
val_b = substring(expr,cmpofs+1,strlen(expr));
- if(bot_cmd_eval(val_a)<bot_cmd_eval(val_b))
- self.bot_cmd_condition_status |= CMD_CONDITION_true;
+ if(bot_cmd_eval(this, val_a)<bot_cmd_eval(this, val_b))
+ this.bot_cmd_condition_status |= CMD_CONDITION_true;
else
- self.bot_cmd_condition_status |= CMD_CONDITION_false;
+ this.bot_cmd_condition_status |= CMD_CONDITION_false;
return CMD_STATUS_FINISHED;
}
- if(bot_cmd_eval(expr))
- self.bot_cmd_condition_status |= CMD_CONDITION_true;
+ if(bot_cmd_eval(this, expr))
+ this.bot_cmd_condition_status |= CMD_CONDITION_true;
else
- self.bot_cmd_condition_status |= CMD_CONDITION_false;
+ this.bot_cmd_condition_status |= CMD_CONDITION_false;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_else()
-{SELFPARAM();
- self.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK;
- self.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK;
+float bot_cmd_else(entity this)
+{
+ this.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK;
+ this.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_fi()
-{SELFPARAM();
- self.bot_cmd_condition_status = CMD_CONDITION_NONE;
+float bot_cmd_fi(entity this)
+{
+ this.bot_cmd_condition_status = CMD_CONDITION_NONE;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_resetaim()
-{SELFPARAM();
- self.v_angle = '0 0 0';
+float bot_cmd_resetaim(entity this)
+{
+ this.v_angle = '0 0 0';
return CMD_STATUS_FINISHED;
}
.vector bot_cmd_aim_begin;
.vector bot_cmd_aim_end;
-float bot_cmd_aim()
-{SELFPARAM();
+float bot_cmd_aim(entity this)
+{
// Current direction
- if(self.bot_cmd_aim_endtime)
+ if(this.bot_cmd_aim_endtime)
{
float progress;
- progress = min(1 - (self.bot_cmd_aim_endtime - time) / (self.bot_cmd_aim_endtime - self.bot_cmd_aim_begintime),1);
- self.v_angle = self.bot_cmd_aim_begin + ((self.bot_cmd_aim_end - self.bot_cmd_aim_begin) * progress);
+ progress = min(1 - (this.bot_cmd_aim_endtime - time) / (this.bot_cmd_aim_endtime - this.bot_cmd_aim_begintime),1);
+ this.v_angle = this.bot_cmd_aim_begin + ((this.bot_cmd_aim_end - this.bot_cmd_aim_begin) * progress);
- if(time>=self.bot_cmd_aim_endtime)
+ if(time>=this.bot_cmd_aim_endtime)
{
- self.bot_cmd_aim_endtime = 0;
+ this.bot_cmd_aim_endtime = 0;
return CMD_STATUS_FINISHED;
}
else
if(step == 0)
{
- self.v_angle_x -= stof(argv(1));
- self.v_angle_y += stof(argv(0));
+ this.v_angle_x -= stof(argv(1));
+ this.v_angle_y += stof(argv(0));
return CMD_STATUS_FINISHED;
}
- self.bot_cmd_aim_begin = self.v_angle;
+ this.bot_cmd_aim_begin = this.v_angle;
- self.bot_cmd_aim_end_x = self.v_angle.x - stof(argv(1));
- self.bot_cmd_aim_end_y = self.v_angle.y + stof(argv(0));
- self.bot_cmd_aim_end_z = 0;
+ this.bot_cmd_aim_end_x = this.v_angle.x - stof(argv(1));
+ this.bot_cmd_aim_end_y = this.v_angle.y + stof(argv(0));
+ this.bot_cmd_aim_end_z = 0;
- self.bot_cmd_aim_begintime = time;
- self.bot_cmd_aim_endtime = time + step;
+ this.bot_cmd_aim_begintime = time;
+ this.bot_cmd_aim_endtime = time + step;
return CMD_STATUS_EXECUTING;
}
-float bot_cmd_aimtarget()
-{SELFPARAM();
- if(self.bot_cmd_aim_endtime)
+float bot_cmd_aimtarget(entity this)
+{
+ if(this.bot_cmd_aim_endtime)
{
- return bot_cmd_aim();
+ return bot_cmd_aim(this);
}
entity e;
tokens = tokenizebyseparator(parms, " ");
- e = bot_getplace(argv(0));
+ e = bot_getplace(this, argv(0));
if(!e)
return CMD_STATUS_ERROR;
if(tokens==1)
{
- self.v_angle = vectoangles(v - (self.origin + self.view_ofs));
- self.v_angle_x = -self.v_angle.x;
+ this.v_angle = vectoangles(v - (this.origin + this.view_ofs));
+ this.v_angle_x = -this.v_angle.x;
return CMD_STATUS_FINISHED;
}
step = stof(argv(1));
- self.bot_cmd_aim_begin = self.v_angle;
- self.bot_cmd_aim_end = vectoangles(v - (self.origin + self.view_ofs));
- self.bot_cmd_aim_end_x = -self.bot_cmd_aim_end.x;
+ this.bot_cmd_aim_begin = this.v_angle;
+ this.bot_cmd_aim_end = vectoangles(v - (this.origin + this.view_ofs));
+ this.bot_cmd_aim_end_x = -this.bot_cmd_aim_end.x;
- self.bot_cmd_aim_begintime = time;
- self.bot_cmd_aim_endtime = time + step;
+ this.bot_cmd_aim_begintime = time;
+ this.bot_cmd_aim_endtime = time + step;
return CMD_STATUS_EXECUTING;
}
const int BOT_CMD_KEY_CROUCH = BIT(9);
const int BOT_CMD_KEY_CHAT = BIT(10);
-float bot_presskeys()
-{SELFPARAM();
- self.movement = '0 0 0';
- PHYS_INPUT_BUTTON_JUMP(self) = false;
- PHYS_INPUT_BUTTON_CROUCH(self) = false;
- PHYS_INPUT_BUTTON_ATCK(self) = false;
- PHYS_INPUT_BUTTON_ATCK2(self) = false;
- PHYS_INPUT_BUTTON_USE(self) = false;
- PHYS_INPUT_BUTTON_HOOK(self) = false;
- PHYS_INPUT_BUTTON_CHAT(self) = false;
-
- if(self.bot_cmd_keys == BOT_CMD_KEY_NONE)
+bool bot_presskeys(entity this)
+{
+ this.movement = '0 0 0';
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
+ PHYS_INPUT_BUTTON_CROUCH(this) = false;
+ PHYS_INPUT_BUTTON_ATCK(this) = false;
+ PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ PHYS_INPUT_BUTTON_USE(this) = false;
+ PHYS_INPUT_BUTTON_HOOK(this) = false;
+ PHYS_INPUT_BUTTON_CHAT(this) = false;
+
+ if(this.bot_cmd_keys == BOT_CMD_KEY_NONE)
return false;
- if(self.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
- self.movement_x = autocvar_sv_maxspeed;
- else if(self.bot_cmd_keys & BOT_CMD_KEY_BACKWARD)
- self.movement_x = -autocvar_sv_maxspeed;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
+ this.movement_x = autocvar_sv_maxspeed;
+ else if(this.bot_cmd_keys & BOT_CMD_KEY_BACKWARD)
+ this.movement_x = -autocvar_sv_maxspeed;
- if(self.bot_cmd_keys & BOT_CMD_KEY_RIGHT)
- self.movement_y = autocvar_sv_maxspeed;
- else if(self.bot_cmd_keys & BOT_CMD_KEY_LEFT)
- self.movement_y = -autocvar_sv_maxspeed;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_RIGHT)
+ this.movement_y = autocvar_sv_maxspeed;
+ else if(this.bot_cmd_keys & BOT_CMD_KEY_LEFT)
+ this.movement_y = -autocvar_sv_maxspeed;
- if(self.bot_cmd_keys & BOT_CMD_KEY_JUMP)
- PHYS_INPUT_BUTTON_JUMP(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_JUMP)
+ PHYS_INPUT_BUTTON_JUMP(this) = true;
- if(self.bot_cmd_keys & BOT_CMD_KEY_CROUCH)
- PHYS_INPUT_BUTTON_CROUCH(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_CROUCH)
+ PHYS_INPUT_BUTTON_CROUCH(this) = true;
- if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK1)
- PHYS_INPUT_BUTTON_ATCK(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_ATTACK1)
+ PHYS_INPUT_BUTTON_ATCK(this) = true;
- if(self.bot_cmd_keys & BOT_CMD_KEY_ATTACK2)
- PHYS_INPUT_BUTTON_ATCK2(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_ATTACK2)
+ PHYS_INPUT_BUTTON_ATCK2(this) = true;
- if(self.bot_cmd_keys & BOT_CMD_KEY_USE)
- PHYS_INPUT_BUTTON_USE(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_USE)
+ PHYS_INPUT_BUTTON_USE(this) = true;
- if(self.bot_cmd_keys & BOT_CMD_KEY_HOOK)
- PHYS_INPUT_BUTTON_HOOK(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_HOOK)
+ PHYS_INPUT_BUTTON_HOOK(this) = true;
- if(self.bot_cmd_keys & BOT_CMD_KEY_CHAT)
- PHYS_INPUT_BUTTON_CHAT(self) = true;
+ if(this.bot_cmd_keys & BOT_CMD_KEY_CHAT)
+ PHYS_INPUT_BUTTON_CHAT(this) = true;
return true;
}
-float bot_cmd_keypress_handler(string key, float enabled)
-{SELFPARAM();
+float bot_cmd_keypress_handler(entity this, string key, float enabled)
+{
switch(key)
{
case "all":
if(enabled)
- self.bot_cmd_keys = power2of(20) - 1; // >:)
+ this.bot_cmd_keys = power2of(20) - 1; // >:)
else
- self.bot_cmd_keys = BOT_CMD_KEY_NONE;
+ this.bot_cmd_keys = BOT_CMD_KEY_NONE;
case "forward":
if(enabled)
{
- self.bot_cmd_keys |= BOT_CMD_KEY_FORWARD;
- self.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
+ this.bot_cmd_keys |= BOT_CMD_KEY_FORWARD;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
}
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
break;
case "backward":
if(enabled)
{
- self.bot_cmd_keys |= BOT_CMD_KEY_BACKWARD;
- self.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
+ this.bot_cmd_keys |= BOT_CMD_KEY_BACKWARD;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_FORWARD;
}
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_BACKWARD;
break;
case "left":
if(enabled)
{
- self.bot_cmd_keys |= BOT_CMD_KEY_LEFT;
- self.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
+ this.bot_cmd_keys |= BOT_CMD_KEY_LEFT;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
}
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
break;
case "right":
if(enabled)
{
- self.bot_cmd_keys |= BOT_CMD_KEY_RIGHT;
- self.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
+ this.bot_cmd_keys |= BOT_CMD_KEY_RIGHT;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_LEFT;
}
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_RIGHT;
break;
case "jump":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_JUMP;
+ this.bot_cmd_keys |= BOT_CMD_KEY_JUMP;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_JUMP;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_JUMP;
break;
case "crouch":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_CROUCH;
+ this.bot_cmd_keys |= BOT_CMD_KEY_CROUCH;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_CROUCH;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_CROUCH;
break;
case "attack1":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_ATTACK1;
+ this.bot_cmd_keys |= BOT_CMD_KEY_ATTACK1;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK1;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK1;
break;
case "attack2":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_ATTACK2;
+ this.bot_cmd_keys |= BOT_CMD_KEY_ATTACK2;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK2;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_ATTACK2;
break;
case "use":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_USE;
+ this.bot_cmd_keys |= BOT_CMD_KEY_USE;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_USE;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_USE;
break;
case "hook":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_HOOK;
+ this.bot_cmd_keys |= BOT_CMD_KEY_HOOK;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_HOOK;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_HOOK;
break;
case "chat":
if(enabled)
- self.bot_cmd_keys |= BOT_CMD_KEY_CHAT;
+ this.bot_cmd_keys |= BOT_CMD_KEY_CHAT;
else
- self.bot_cmd_keys &= ~BOT_CMD_KEY_CHAT;
+ this.bot_cmd_keys &= ~BOT_CMD_KEY_CHAT;
break;
default:
break;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_presskey()
+float bot_cmd_presskey(entity this)
{
string key;
key = bot_cmd.bot_cmd_parm_string;
- bot_cmd_keypress_handler(key,true);
+ bot_cmd_keypress_handler(this, key,true);
return CMD_STATUS_FINISHED;
}
-float bot_cmd_releasekey()
+float bot_cmd_releasekey(entity this)
{
string key;
key = bot_cmd.bot_cmd_parm_string;
- return bot_cmd_keypress_handler(key,false);
+ return bot_cmd_keypress_handler(this, key,false);
}
-float bot_cmd_pause()
-{SELFPARAM();
- PHYS_INPUT_BUTTON_DRAG(self) = false;
- PHYS_INPUT_BUTTON_USE(self) = false;
- PHYS_INPUT_BUTTON_ATCK(self) = false;
- PHYS_INPUT_BUTTON_JUMP(self) = false;
- PHYS_INPUT_BUTTON_HOOK(self) = false;
- PHYS_INPUT_BUTTON_CHAT(self) = false;
- PHYS_INPUT_BUTTON_ATCK2(self) = false;
- PHYS_INPUT_BUTTON_CROUCH(self) = false;
-
- self.movement = '0 0 0';
- self.bot_cmd_keys = BOT_CMD_KEY_NONE;
-
- self.bot_exec_status |= BOT_EXEC_STATUS_PAUSED;
+float bot_cmd_pause(entity this)
+{
+ PHYS_INPUT_BUTTON_DRAG(this) = false;
+ PHYS_INPUT_BUTTON_USE(this) = false;
+ PHYS_INPUT_BUTTON_ATCK(this) = false;
+ PHYS_INPUT_BUTTON_JUMP(this) = false;
+ PHYS_INPUT_BUTTON_HOOK(this) = false;
+ PHYS_INPUT_BUTTON_CHAT(this) = false;
+ PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ PHYS_INPUT_BUTTON_CROUCH(this) = false;
+
+ this.movement = '0 0 0';
+ this.bot_cmd_keys = BOT_CMD_KEY_NONE;
+
+ this.bot_exec_status |= BOT_EXEC_STATUS_PAUSED;
return CMD_STATUS_FINISHED;
}
-float bot_cmd_moveto()
-{SELFPARAM();
- return self.cmd_moveto(bot_cmd.bot_cmd_parm_vector);
+float bot_cmd_moveto(entity this)
+{
+ return this.cmd_moveto(this, bot_cmd.bot_cmd_parm_vector);
}
-float bot_cmd_movetotarget()
-{SELFPARAM();
+float bot_cmd_movetotarget(entity this)
+{
entity e;
- e = bot_getplace(bot_cmd.bot_cmd_parm_string);
+ e = bot_getplace(this, bot_cmd.bot_cmd_parm_string);
if(!e)
return CMD_STATUS_ERROR;
- return self.cmd_moveto(e.origin + (e.mins + e.maxs) * 0.5);
+ return this.cmd_moveto(this, e.origin + (e.mins + e.maxs) * 0.5);
}
-float bot_cmd_resetgoal()
-{SELFPARAM();
- return self.cmd_resetgoal();
+float bot_cmd_resetgoal(entity this)
+{
+ return this.cmd_resetgoal(this);
}
-float bot_cmd_sound()
-{SELFPARAM();
+float bot_cmd_sound(entity this)
+{
string f;
f = bot_cmd.bot_cmd_parm_string;
atten = stof(argv(2));
precache_sound(f);
- _sound(self, chan, sample, vol, atten);
+ _sound(this, chan, sample, vol, atten);
return CMD_STATUS_FINISHED;
}
.entity tuba_note;
-float bot_cmd_debug_assert_canfire()
-{SELFPARAM();
+float bot_cmd_debug_assert_canfire(entity this)
+{
float f = bot_cmd.bot_cmd_parm_float;
int slot = 0;
.entity weaponentity = weaponentities[slot];
- if(self.(weaponentity).state != WS_READY)
+ if(this.(weaponentity).state != WS_READY)
{
if(f)
{
- self.colormod = '0 8 8';
- LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by weaponentity state\n");
+ this.colormod = '0 8 8';
+ LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " wants to fire, inhibited by weaponentity state\n");
}
}
- else if(ATTACK_FINISHED(self, slot) > time)
+ else if(ATTACK_FINISHED(this, slot) > time)
{
if(f)
{
- self.colormod = '8 0 8';
- LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(self, slot) - time), " seconds left)\n");
+ this.colormod = '8 0 8';
+ LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)\n");
}
}
- else if(self.tuba_note)
+ else if(this.tuba_note)
{
if(f)
{
- self.colormod = '8 0 0';
- LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " wants to fire, bot still has an active tuba note\n");
+ this.colormod = '8 0 0';
+ LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " wants to fire, bot still has an active tuba note\n");
}
}
else
{
if(!f)
{
- self.colormod = '8 8 0';
- LOG_INFO("Bot ", self.netname, " using ", self.weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(self, slot) - time), " seconds left\n");
+ this.colormod = '8 8 0';
+ LOG_INFO("Bot ", this.netname, " using ", this.weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left\n");
}
}
//
-void bot_command_executed(float rm)
-{SELFPARAM();
+void bot_command_executed(entity this, bool rm)
+{
entity cmd;
cmd = bot_cmd;
if(rm)
- bot_dequeuecommand(self, self.bot_cmd_execution_index);
+ bot_dequeuecommand(this, this.bot_cmd_execution_index);
- self.bot_cmd_execution_index++;
+ this.bot_cmd_execution_index++;
}
-void bot_setcurrentcommand()
-{SELFPARAM();
+void bot_setcurrentcommand(entity this)
+{
bot_cmd = world;
- if(!self.bot_cmd_current)
+ if(!this.bot_cmd_current)
{
- self.bot_cmd_current = new_pure(bot_cmd);
- self.bot_cmd_current.is_bot_cmd = true;
+ this.bot_cmd_current = new_pure(bot_cmd);
+ this.bot_cmd_current.is_bot_cmd = true;
}
- bot_cmd = self.bot_cmd_current;
- if(bot_cmd.bot_cmd_index != self.bot_cmd_execution_index || self.bot_cmd_execution_index == 0)
+ bot_cmd = this.bot_cmd_current;
+ if(bot_cmd.bot_cmd_index != this.bot_cmd_execution_index || this.bot_cmd_execution_index == 0)
{
- if(bot_havecommand(self, self.bot_cmd_execution_index))
+ if(bot_havecommand(this, this.bot_cmd_execution_index))
{
string cmdstring;
- cmdstring = bot_readcommand(self, self.bot_cmd_execution_index);
+ cmdstring = bot_readcommand(this, this.bot_cmd_execution_index);
if(bot_decodecommand(cmdstring))
{
- bot_cmd.owner = self;
- bot_cmd.bot_cmd_index = self.bot_cmd_execution_index;
+ bot_cmd.owner = this;
+ bot_cmd.bot_cmd_index = this.bot_cmd_execution_index;
}
else
{
// Invalid command, remove from queue
bot_cmd = world;
- bot_dequeuecommand(self, self.bot_cmd_execution_index);
- self.bot_cmd_execution_index++;
+ bot_dequeuecommand(this, this.bot_cmd_execution_index);
+ this.bot_cmd_execution_index++;
}
}
else
// Here we map commands to functions and deal with complex interactions between commands and execution states
// NOTE: Of course you need to include your commands here too :)
-float bot_execute_commands_once()
-{SELFPARAM();
+float bot_execute_commands_once(entity this)
+{
float status, ispressingkey;
// Find command
- bot_setcurrentcommand();
+ bot_setcurrentcommand(this);
// if we have no bot command, better return
// old logic kept pressing previously pressed keys, but that has problems
return false;
// Ignore all commands except continue when the bot is paused
- if(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
+ if(this.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
if(bot_cmd.bot_cmd_type!=BOT_CMD_CONTINUE)
{
if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
{
- bot_command_executed(true);
+ bot_command_executed(this, true);
LOG_INFO( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
}
return 1;
}
// Keep pressing keys raised by the "presskey" command
- ispressingkey = boolean(bot_presskeys());
+ ispressingkey = boolean(bot_presskeys(this));
// Handle conditions
if (!(bot_cmd.bot_cmd_type==BOT_CMD_FI||bot_cmd.bot_cmd_type==BOT_CMD_ELSE))
- if(self.bot_cmd_condition_status & CMD_CONDITION_true && self.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK)
+ if(this.bot_cmd_condition_status & CMD_CONDITION_true && this.bot_cmd_condition_status & CMD_CONDITION_false_BLOCK)
{
- bot_command_executed(true);
+ bot_command_executed(this, true);
return -1;
}
- else if(self.bot_cmd_condition_status & CMD_CONDITION_false && self.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK)
+ else if(this.bot_cmd_condition_status & CMD_CONDITION_false && this.bot_cmd_condition_status & CMD_CONDITION_true_BLOCK)
{
- bot_command_executed(true);
+ bot_command_executed(this, true);
return -1;
}
return ispressingkey;
//break;
case BOT_CMD_PAUSE:
- status = bot_cmd_pause();
+ status = bot_cmd_pause(this);
break;
case BOT_CMD_CONTINUE:
- status = bot_cmd_continue();
+ status = bot_cmd_continue(this);
break;
case BOT_CMD_WAIT:
- status = bot_cmd_wait();
+ status = bot_cmd_wait(this);
break;
case BOT_CMD_WAIT_UNTIL:
- status = bot_cmd_wait_until();
+ status = bot_cmd_wait_until(this);
break;
case BOT_CMD_TURN:
- status = bot_cmd_turn();
+ status = bot_cmd_turn(this);
break;
case BOT_CMD_MOVETO:
- status = bot_cmd_moveto();
+ status = bot_cmd_moveto(this);
break;
case BOT_CMD_MOVETOTARGET:
- status = bot_cmd_movetotarget();
+ status = bot_cmd_movetotarget(this);
break;
case BOT_CMD_RESETGOAL:
- status = bot_cmd_resetgoal();
+ status = bot_cmd_resetgoal(this);
break;
case BOT_CMD_CC:
- status = bot_cmd_cc();
+ status = bot_cmd_cc(this);
break;
case BOT_CMD_IF:
- status = bot_cmd_if();
+ status = bot_cmd_if(this);
break;
case BOT_CMD_ELSE:
- status = bot_cmd_else();
+ status = bot_cmd_else(this);
break;
case BOT_CMD_FI:
- status = bot_cmd_fi();
+ status = bot_cmd_fi(this);
break;
case BOT_CMD_RESETAIM:
- status = bot_cmd_resetaim();
+ status = bot_cmd_resetaim(this);
break;
case BOT_CMD_AIM:
- status = bot_cmd_aim();
+ status = bot_cmd_aim(this);
break;
case BOT_CMD_AIMTARGET:
- status = bot_cmd_aimtarget();
+ status = bot_cmd_aimtarget(this);
break;
case BOT_CMD_PRESSKEY:
- status = bot_cmd_presskey();
+ status = bot_cmd_presskey(this);
break;
case BOT_CMD_RELEASEKEY:
- status = bot_cmd_releasekey();
+ status = bot_cmd_releasekey(this);
break;
case BOT_CMD_SELECTWEAPON:
- status = bot_cmd_select_weapon();
+ status = bot_cmd_select_weapon(this);
break;
case BOT_CMD_IMPULSE:
- status = bot_cmd_impulse();
+ status = bot_cmd_impulse(this);
break;
case BOT_CMD_BARRIER:
- status = bot_cmd_barrier();
+ status = bot_cmd_barrier(this);
break;
case BOT_CMD_CONSOLE:
localcmd(strcat(bot_cmd.bot_cmd_parm_string, "\n"));
status = CMD_STATUS_FINISHED;
break;
case BOT_CMD_SOUND:
- status = bot_cmd_sound();
+ status = bot_cmd_sound(this);
break;
case BOT_CMD_DEBUG_ASSERT_CANFIRE:
- status = bot_cmd_debug_assert_canfire();
+ status = bot_cmd_debug_assert_canfire(this);
break;
default:
LOG_INFO(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
parms = "";
break;
}
- clientcommand(self,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
+ clientcommand(this,strcat("say ^7", bot_cmd_string[bot_cmd.bot_cmd_type]," ",parms,"\n"));
}
- bot_command_executed(true);
+ bot_command_executed(this, true);
}
if(status == CMD_STATUS_FINISHED)
}
// This function should be (the only) called directly from the bot ai loop
-float bot_execute_commands()
+int bot_execute_commands(entity this)
{
- float f;
+ int f;
do
{
- f = bot_execute_commands_once();
+ f = bot_execute_commands_once(this);
}
while(f < 0);
return f;
-#ifndef BOT_SCRIPTING_H
-#define BOT_SCRIPTING_H
+#pragma once
#define BOT_EXEC_STATUS_IDLE 0
#define BOT_EXEC_STATUS_PAUSED 1
// NOTE: Following commands should be implemented on the bot ai
// If a new command should be handled by the target ai(s) please declare it here
-.float(vector) cmd_moveto;
-.float() cmd_resetgoal;
+.float(entity, vector) cmd_moveto;
+.float(entity) cmd_resetgoal;
//
const int BOT_CMD_PARAMETER_NONE = 0;
void bot_queuecommand(entity bot, string cmdstring);
void bot_cmdhelp(string scmd);
void bot_list_commands();
-float bot_execute_commands();
+float bot_execute_commands(entity this);
entity find_bot_by_name(string name);
entity find_bot_by_number(float number);
-#endif
#include "bot.qh"
#include "navigation.qh"
+#include <common/state.qh>
+
#include "../antilag.qh"
#include <common/constants.qh>
ev.z = bound(em1_z, ev.z, em2_z);
dv = ev - sv;
dv.z = 0;
- if (vlen(dv) >= 1050) // max search distance in XY
+ if(vdist(dv, >=, 1050)) // max search distance in XY
{
++relink_lengthculled;
continue;
// spawnfunc_waypoint map entity
spawnfunc(waypoint)
{
- setorigin(self, self.origin);
+ setorigin(this, this.origin);
// schedule a relink after other waypoints have had a chance to spawn
- waypoint_clearlinks(self);
- //waypoint_schedulerelink(self);
+ waypoint_clearlinks(this);
+ //waypoint_schedulerelink(this);
}
// remove a spawnfunc_waypoint, and schedule all neighbors to relink
waypoint_spawnforteleporter_boxes(e, e.absmin, e.absmax, destination, destination, timetaken);
}
-entity waypoint_spawnpersonal(vector position)
-{SELFPARAM();
+entity waypoint_spawnpersonal(entity this, vector position)
+{
entity w;
// drop the waypoint to a proper location:
w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
w.nearestwaypoint = world;
w.nearestwaypointtimeout = 0;
- w.owner = self;
+ w.owner = this;
waypoint_schedulerelink(w);
}
t = (tmin + tmax) * 0.5;
- o = antilag_takebackorigin(p, time - t);
+ o = antilag_takebackorigin(p, CS(p), time - t);
if(!botframe_autowaypoints_fixdown(o))
return -2;
o = trace_endpos;
goto next;
}
}
-:next
+LABEL(next)
}
}
// d) The waypoint is a dead end. Dead end waypoints must be kept as
-#ifndef WAYPOINTS_H
-#define WAYPOINTS_H
+#pragma once
/*
* Globals and Fields
*/
float waypoint_load_links();
entity waypoint_spawn(vector m1, vector m2, float f);
-entity waypoint_spawnpersonal(vector position);
+entity waypoint_spawnpersonal(entity this, vector position);
vector waypoint_fixorigin(vector position);
void botframe_autowaypoints();
-#endif
-#ifndef CAMPAIGN_H
-#define CAMPAIGN_H
+#pragma once
// this must be included BEFORE campaign_common.h to make this a memory saving
#define CAMPAIGN_MAX_ENTRIES 2
void CampaignLevelWarp(float n);
-float campaign_bots_may_start;
-// campaign mode: bots shall spawn but wait for the player to spawn before they do anything
-// in other game modes, this is ignored
-#endif
+/**
+ * campaign mode: bots shall spawn but wait for the player to spawn before they do anything
+ * in other game modes, this is ignored
+ */
+bool campaign_bots_may_start;
cheatcount_total += n; \
e.cheatcount += n
#define END_CHEAT_FUNCTION() \
- ADD_CHEATS(self,cheating); \
+ ADD_CHEATS(this, cheating); \
return attempting
#define IS_CHEAT(i,argc,fr) \
if((++attempting, !CheatsAllowed(i,argc,fr))) \
break
float num_autoscreenshot;
-void info_autoscreenshot_findtarget()
-{SELFPARAM();
+void info_autoscreenshot_findtarget(entity this)
+{
entity e;
e = find(world, targetname, self.target);
if(!e)
// arguments:
// effectname
effectnum = _particleeffectnum(argv(1));
- W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
+ W_SetupShot(self, false, false, SND_Null, CH_WEAPON_A, 0);
traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
__trailparticles(self, effectnum, w_shotorg, trace_endpos);
DID_CHEAT();
// arguments:
// modelname mode
f = stof(argv(2));
- W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
+ W_SetupShot(self, false, false, SND_Null, CH_WEAPON_A, 0);
traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, self);
if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
{
e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
}
- WITH(entity, self, e, spawnfunc_func_breakable(e));
+ WITHSELF(e, spawnfunc_func_breakable(e));
// now, is it valid?
if(f == 0)
{
setself(new(cheattriggerteleport));
setorigin(self, self.origin);
self.target = argv(1);
- teleport_findtarget();
+ teleport_findtarget(self);
if(!wasfreed(self))
{
Simple_TeleportPlayer(self, this);
switch(0)
{
default:
- if(self.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
+ if(this.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
{
// use cheat dragging if cheats are enabled
- crosshair_trace_plusvisibletriggers(self);
+ crosshair_trace_plusvisibletriggers(this);
Drag(true, true);
}
else
switch(0)
{
default:
- if(Drag_IsDragging(self))
+ if(Drag_IsDragging(this))
{
- if(PHYS_INPUT_BUTTON_DRAG(self))
+ if(PHYS_INPUT_BUTTON_DRAG(this))
{
- if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+ if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
{
- Drag_MoveForward(self);
- self.impulse = 0;
+ Drag_MoveForward(this);
+ this.impulse = 0;
}
- else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19)
+ else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
{
- Drag_MoveBackward(self);
- self.impulse = 0;
+ Drag_MoveBackward(this);
+ this.impulse = 0;
}
- else if(self.impulse >= 1 && self.impulse <= 9)
+ else if(this.impulse >= 1 && this.impulse <= 9)
{
- Drag_SetSpeed(self, self.impulse - 1);
+ Drag_SetSpeed(this, this.impulse - 1);
}
- else if(self.impulse == 14)
+ else if(this.impulse == 14)
{
- Drag_SetSpeed(self, 9);
+ Drag_SetSpeed(this, 9);
}
if(frametime)
- Drag_Update(self);
+ Drag_Update(this);
}
else
{
- Drag_Finish(self);
+ Drag_Finish(this);
}
}
else
{
- if(Drag_CanDrag(self))
- if(PHYS_INPUT_BUTTON_DRAG(self))
+ if(Drag_CanDrag(this))
+ if(PHYS_INPUT_BUTTON_DRAG(this))
{
- crosshair_trace_plusvisibletriggers(self);
+ crosshair_trace_plusvisibletriggers(this);
entity e = trace_ent;
float pick = force_allow_pick;
if (e && !pick)
// This also makes sure that an object can only pe picked up if in range, but does not get dropped if
// it goes out of range while slinging it around.
- if(vlen(self.origin - e.origin) <= autocvar_g_grab_range)
+ if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
{
switch(e.grab)
{
case 0: // can't grab
break;
case 1: // owner can grab
- if(e.owner == self || e.realowner == self)
+ if(e.owner == this || e.realowner == this)
pick = true;
break;
case 2: // owner and team mates can grab
- if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
+ if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
pick = true;
break;
case 3: // anyone can grab
Drag_Finish(e.draggedby);
if(e.tag_entity)
detach_sameorigin(e);
- Drag_Begin(self, e, trace_endpos);
+ Drag_Begin(this, e, trace_endpos);
if(ischeat)
DID_CHEAT();
return true;
void DragBox_Think()
{SELFPARAM();
- if(self.aiment && self.enemy)
+ if(this.aiment && this.enemy)
{
- self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
- self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5;
- self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5;
- self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5;
- self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5;
- self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5;
- self.mins = -1 * self.maxs;
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs); // link edict
+ this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
+ this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
+ this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
+ this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
+ this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
+ this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
+ this.mins = -1 * this.maxs;
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs); // link edict
}
- if(self.cnt == -1) // actually race_place -1
+ if(this.cnt == -1) // actually race_place -1
{
// show "10 10" for qualifying spawns
- setmodel(self.killindicator, MDL_NUM(10));
- setmodel(self.killindicator.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(10));
}
- else if(self.cnt == -2) // actually race_place 0
+ else if(this.cnt == -2) // actually race_place 0
{
// show "10 0" for loser spawns
- setmodel(self.killindicator, MDL_NUM(10));
- setmodel(self.killindicator.killindicator, MDL_NUM(0));
+ setmodel(this.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(0));
}
else
{
- setmodel(self.killindicator, MDL_NUM(self.cnt % 10));
- setmodel(self.killindicator.killindicator, MDL_NUM(floor(self.cnt / 10)));
+ setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
}
- self.nextthink = time;
+ this.nextthink = time;
}
#endif
-#ifndef CHEATS_H
-#define CHEATS_H
+#pragma once
-#include "../common/impulses/all.qh"
+#include <common/impulses/all.qh>
//float autocvar_sv_cheats; // must... declare... global
const float CHRAME_DRAG = 8;
void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
-#endif
#include "../common/ent_cs.qh"
#include <common/state.qh>
+#include <common/effects/qc/globalsound.qh>
+
#include "../common/triggers/teleporters.qh"
#include "../common/vehicles/all.qh"
#include "../lib/warpzone/server.qh"
+STATIC_METHOD(Client, Add, void(Client this, int _team))
+{
+ WITHSELF(this, ClientConnect());
+ TRANSMUTE(Player, this);
+ this.frame = 12; // 7
+ this.team = _team;
+ WITHSELF(this, PutClientInServer());
+}
+
+void PutObserverInServer();
+void ClientDisconnect();
+
+STATIC_METHOD(Client, Remove, void(Client this))
+{
+ TRANSMUTE(Observer, this);
+ WITHSELF(this, PutClientInServer());
+ WITHSELF(this, ClientDisconnect());
+}
void send_CSQC_teamnagger() {
WriteHeader(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
void ClientData_Attach(entity this)
{
Net_LinkEntity(this.clientdata = new_pure(clientdata), false, 0, ClientData_Send);
- self.clientdata.drawonlytoclient = this;
- self.clientdata.owner = this;
+ this.clientdata.drawonlytoclient = this;
+ this.clientdata.owner = this;
}
void ClientData_Detach(entity this)
{
remove(this.clientdata);
- self.clientdata = NULL;
+ this.clientdata = NULL;
}
void ClientData_Touch(entity e)
precache_model(modelname);
_setmodel(e, modelname);
player_setupanimsformodel();
+ if(!autocvar_g_debug_globalsounds)
+ UpdatePlayerSounds(e);
}
void FixPlayermodel(entity player);
}
// give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
// so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
+ if(!autocvar_g_debug_globalsounds)
+ {
+ // needed for player sounds
+ this.model = "";
+ FixPlayermodel(this);
+ }
setmodel(this, MDL_Null);
setsize(this, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL));
this.view_ofs = '0 0 0';
this.spectatortime = time;
this.bot_attack = false;
this.hud = HUD_NORMAL;
- this.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
this.iscreature = false;
this.teleportable = TELEPORT_SIMPLE;
this.damagedbycontents = false;
if(chmdl || oldskin != player.skin) // model or skin has changed
{
player.species = player_getspecies(player); // update species
+ if(!autocvar_g_debug_globalsounds)
+ UpdatePlayerSounds(player); // update skin sounds
}
if(!teamplay)
{
SELFPARAM();
if (IS_BOT_CLIENT(this)) {
- this.classname = STR_PLAYER;
+ TRANSMUTE(Player, this);
} else if (IS_REAL_CLIENT(this)) {
msg_entity = this;
WriteByte(MSG_ONE, SVC_SETVIEW);
WriteEntity(MSG_ONE, this);
}
if (gameover) {
- this.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
}
SetSpectatee(this, NULL);
return; // spawn failed
}
- this.classname = STR_PLAYER;
+ TRANSMUTE(Player, this);
this.wasplayer = true;
this.iscreature = true;
this.teleportable = TELEPORT_NORMAL;
string s = spot.target;
spot.target = string_null;
WITH(entity, activator, this, LAMBDA(
- WITH(entity, self, spot, SUB_UseTargets())
+ WITHSELF(spot, SUB_UseTargets())
));
spot.target = s;
}
if (!warmup_stage && !this.alivetime)
this.alivetime = time;
- antilag_clear(this);
+ antilag_clear(this, CS(this));
}
}
}
void ClientInit_misc()
{
+ SELFPARAM();
int channel = MSG_ONE;
WriteHeader(channel, ENT_CLIENT_INIT);
WriteByte(channel, g_nexball_meter_period * 32);
WriteString(channel, world.fog);
else
WriteString(channel, "");
- WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
+ WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
WriteByte(channel, serverflags); // client has to know if it should zoom or not
WriteCoord(channel, autocvar_g_trueaim_minrange);
}
void ClientInit_CheckUpdate()
{SELFPARAM();
- self.nextthink = time;
- if(self.count != autocvar_g_balance_armor_blockpercent)
+ this.nextthink = time;
+ if(this.count != autocvar_g_balance_armor_blockpercent)
{
- self.count = autocvar_g_balance_armor_blockpercent;
- self.SendFlags |= 1;
+ this.count = autocvar_g_balance_armor_blockpercent;
+ this.SendFlags |= 1;
}
}
e.think = ClientInit_CheckUpdate;
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
- WITH(entity, self, e, ClientInit_CheckUpdate());
+ WITHSELF(e, ClientInit_CheckUpdate());
}
/*
void SetChangeParms ()
{SELFPARAM();
// save parms for level change
- parm1 = self.parm_idlesince - time;
+ parm1 = this.parm_idlesince - time;
MUTATOR_CALLHOOK(SetChangeParms);
}
{
if(blockSpectators)
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- WITH(entity, self, this, PutObserverInServer());
+ WITHSELF(this, PutObserverInServer());
}
else
- WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+ WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1));
this.killindicator_teamchange = 0;
}
void ClientKill_Now()
{SELFPARAM();
- if(self.vehicle)
+ if(this.vehicle)
{
vehicles_exit(VHEF_RELEASE);
- if(!self.killindicator_teamchange)
+ if(!this.killindicator_teamchange)
{
- self.vehicle_health = -1;
- Damage(self, self, self, 1 , DEATH_KILL.m_id, self.origin, '0 0 0');
+ this.vehicle_health = -1;
+ Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
}
}
- if(self.killindicator && !wasfreed(self.killindicator))
- remove(self.killindicator);
+ if(this.killindicator && !wasfreed(this.killindicator))
+ remove(this.killindicator);
- self.killindicator = world;
+ this.killindicator = world;
- if(self.killindicator_teamchange)
- ClientKill_Now_TeamChange(self);
+ if(this.killindicator_teamchange)
+ ClientKill_Now_TeamChange(this);
- if(IS_PLAYER(self))
- Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+ if(IS_PLAYER(this))
+ Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
// now I am sure the player IS dead
}
{SELFPARAM();
if (gameover)
{
- self.owner.killindicator = world;
- remove(self);
+ this.owner.killindicator = world;
+ remove(this);
return;
}
- if (self.owner.alpha < 0 && !self.owner.vehicle)
+ if (this.owner.alpha < 0 && !this.owner.vehicle)
{
- self.owner.killindicator = world;
- remove(self);
+ this.owner.killindicator = world;
+ remove(this);
return;
}
- if(self.cnt <= 0)
+ if(this.cnt <= 0)
{
- WITH(entity, self, self.owner, ClientKill_Now());
+ WITHSELF(this.owner, ClientKill_Now());
return;
}
- else if(g_cts && self.health == 1) // health == 1 means that it's silent
+ else if(g_cts && this.health == 1) // health == 1 means that it's silent
{
- self.nextthink = time + 1;
- self.cnt -= 1;
+ this.nextthink = time + 1;
+ this.cnt -= 1;
}
else
{
- if(self.cnt <= 10)
- setmodel(self, MDL_NUM(self.cnt));
- if(IS_REAL_CLIENT(self.owner))
+ if(this.cnt <= 10)
+ setmodel(this, MDL_NUM(this.cnt));
+ if(IS_REAL_CLIENT(this.owner))
{
- if(self.cnt <= 10)
- { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
+ if(this.cnt <= 10)
+ { Send_Notification(NOTIF_ONE, this.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, this.cnt)); }
}
- self.nextthink = time + 1;
- self.cnt -= 1;
+ this.nextthink = time + 1;
+ this.cnt -= 1;
}
}
if(g_race_qualifying || g_cts)
killtime = 0;
- if(MUTATOR_CALLHOOK(ClientKill, self, killtime))
+ if(MUTATOR_CALLHOOK(ClientKill, this, killtime))
return;
- self.killindicator_teamchange = targetteam;
+ this.killindicator_teamchange = targetteam;
- if(!self.killindicator)
+ if(!this.killindicator)
{
- if(!IS_DEAD(self))
+ if(!IS_DEAD(this))
{
- killtime = max(killtime, self.clientkill_nexttime - time);
- self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
+ killtime = max(killtime, this.clientkill_nexttime - time);
+ this.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
}
- if(killtime <= 0 || !IS_PLAYER(self) || IS_DEAD(self))
+ if(killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this))
{
ClientKill_Now();
}
{
starttime = max(time, clientkilltime);
- self.killindicator = spawn();
- self.killindicator.owner = self;
- self.killindicator.scale = 0.5;
- setattachment(self.killindicator, self, "");
- setorigin(self.killindicator, '0 0 52');
- self.killindicator.think = KillIndicator_Think;
- self.killindicator.nextthink = starttime + (self.lip) * 0.05;
- clientkilltime = max(clientkilltime, self.killindicator.nextthink + 0.05);
- self.killindicator.cnt = ceil(killtime);
- self.killindicator.count = bound(0, ceil(killtime), 10);
- //sprint(self, strcat("^1You'll be dead in ", ftos(self.killindicator.cnt), " seconds\n"));
+ this.killindicator = spawn();
+ this.killindicator.owner = this;
+ this.killindicator.scale = 0.5;
+ setattachment(this.killindicator, this, "");
+ setorigin(this.killindicator, '0 0 52');
+ this.killindicator.think = KillIndicator_Think;
+ this.killindicator.nextthink = starttime + (this.lip) * 0.05;
+ clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
+ this.killindicator.cnt = ceil(killtime);
+ this.killindicator.count = bound(0, ceil(killtime), 10);
+ //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n"));
for(e = world; (e = find(e, classname, "body")) != world; )
{
- if(e.enemy != self)
+ if(e.enemy != this)
continue;
e.killindicator = spawn();
e.killindicator.owner = e;
clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
e.killindicator.cnt = ceil(killtime);
}
- self.lip = 0;
+ this.lip = 0;
}
}
- if(self.killindicator)
+ if(this.killindicator)
{
if(targetteam == 0) // just die
{
- self.killindicator.colormod = '0 0 0';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, self.killindicator.cnt);
+ this.killindicator.colormod = '0 0 0';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, this.killindicator.cnt);
}
else if(targetteam == -1) // auto
{
- self.killindicator.colormod = '0 1 0';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, self.killindicator.cnt);
+ this.killindicator.colormod = '0 1 0';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, this.killindicator.cnt);
}
else if(targetteam == -2) // spectate
{
- self.killindicator.colormod = '0.5 0.5 0.5';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
+ this.killindicator.colormod = '0.5 0.5 0.5';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, this.killindicator.cnt);
}
else
{
- self.killindicator.colormod = Team_ColorRGB(targetteam);
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
+ this.killindicator.colormod = Team_ColorRGB(targetteam);
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), this.killindicator.cnt);
}
}
void ClientKill ()
{SELFPARAM();
if(gameover) return;
- if(self.player_blocked) return;
- if(STAT(FROZEN, self)) return;
+ if(this.player_blocked) return;
+ if(STAT(FROZEN, this)) return;
ClientKill_TeamChange(0);
}
if(autocvar_sv_eventlog)
{
GameLogEcho(sprintf(":connect:%d:%d:%s",
- self.playerid,
- etof(self),
- ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
+ this.playerid,
+ etof(this),
+ ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot")
));
}
}
SELFPARAM();
if (Ban_MaybeEnforceBanOnce(this)) return;
assert(!IS_CLIENT(this), return);
+ this.flags |= FL_CLIENT;
assert(player_count >= 0, player_count = 0);
- this.classname = "player_joining";
- this.flags = FL_CLIENT;
#ifdef WATERMARK
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_WATERMARK, WATERMARK);
#endif
this.version_nagtime = time + 10 + random() * 10;
-
- ClientState_attach(this);
+ TRANSMUTE(Client, this);
// identify the right forced team
if (autocvar_g_campaign)
}
if (!teamplay && this.team_forced > 0) this.team_forced = 0;
- JoinBestTeam(this, false, false); // if the team number is valid, keep it
+ {
+ int id = this.playerid;
+ this.playerid = 0; // silent
+ JoinBestTeam(this, false, false); // if the team number is valid, keep it
+ this.playerid = id;
+ }
if (autocvar_sv_spectate || autocvar_g_campaign || this.team_forced < 0) {
- this.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
} else {
- if (!teamplay || autocvar_g_balance_teams)
- {
- this.classname = STR_PLAYER;
- campaign_bots_may_start = 1;
- }
- else
- {
- this.classname = STR_OBSERVER; // do it anyway
+ if (!teamplay || autocvar_g_balance_teams) {
+ TRANSMUTE(Player, this);
+ campaign_bots_may_start = true;
+ } else {
+ TRANSMUTE(Observer, this); // do it anyway
}
}
- this.playerid = ++playerid_last;
-
PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
// always track bots, don't ask for cl_allow_uidtracking
sv_notice_join(this);
FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
- WITH(entity, self, it, it.init_for_player(it));
+ WITHSELF(it, it.init_for_player(it));
});
MUTATOR_CALLHOOK(ClientConnect, this);
ClientState_detach(this);
- Portal_ClearAll(self);
+ Portal_ClearAll(this);
- Unfreeze(self);
+ Unfreeze(this);
- RemoveGrapplingHook(self);
+ RemoveGrapplingHook(this);
// Here, everything has been done that requires this player to be a client.
- self.flags &= ~FL_CLIENT;
+ this.flags &= ~FL_CLIENT;
if (this.chatbubbleentity) remove(this.chatbubbleentity);
if (this.killindicator) remove(this.killindicator);
bot_relinkplayerlist();
- if (self.netname_previous) strunzone(self.netname_previous);
- if (self.clientstatus) strunzone(self.clientstatus);
- if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
- if (self.personal) remove(self.personal);
+ if (this.netname_previous) strunzone(this.netname_previous);
+ if (this.clientstatus) strunzone(this.clientstatus);
+ if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse);
+ if (this.personal) remove(this.personal);
this.playerid = 0;
ReadyCount();
void ChatBubbleThink()
{SELFPARAM();
- self.nextthink = time;
- if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self)
+ this.nextthink = time;
+ if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
{
- if(self.owner) // but why can that ever be world?
- self.owner.chatbubbleentity = world;
- remove(self);
+ if(this.owner) // but why can that ever be world?
+ this.owner.chatbubbleentity = world;
+ remove(this);
return;
}
- self.mdl = "";
+ this.mdl = "";
- if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) )
+ if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
{
- if ( self.owner.active_minigame )
- self.mdl = "models/sprites/minigame_busy.iqm";
- else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
- self.mdl = "models/misc/chatbubble.spr";
+ if ( this.owner.active_minigame )
+ this.mdl = "models/sprites/minigame_busy.iqm";
+ else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
+ this.mdl = "models/misc/chatbubble.spr";
}
- if ( self.model != self.mdl )
- _setmodel(self, self.mdl);
+ if ( this.model != this.mdl )
+ _setmodel(this, this.mdl);
}
void UpdateChatBubble()
{SELFPARAM();
- if (self.alpha < 0)
+ if (this.alpha < 0)
return;
// spawn a chatbubble entity if needed
- if (!self.chatbubbleentity)
- {
- self.chatbubbleentity = new(chatbubbleentity);
- self.chatbubbleentity.owner = self;
- self.chatbubbleentity.exteriormodeltoclient = self;
- self.chatbubbleentity.think = ChatBubbleThink;
- self.chatbubbleentity.nextthink = time;
- setmodel(self.chatbubbleentity, MDL_CHAT); // precision set below
- //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
- setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
- setattachment(self.chatbubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth
- self.chatbubbleentity.mdl = self.chatbubbleentity.model;
- //self.chatbubbleentity.model = "";
- self.chatbubbleentity.effects = EF_LOWPRECISION;
+ if (!this.chatbubbleentity)
+ {
+ this.chatbubbleentity = new(chatbubbleentity);
+ this.chatbubbleentity.owner = this;
+ this.chatbubbleentity.exteriormodeltoclient = this;
+ this.chatbubbleentity.think = ChatBubbleThink;
+ this.chatbubbleentity.nextthink = time;
+ setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
+ //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
+ setorigin(this.chatbubbleentity, '0 0 15' + this.maxs_z * '0 0 1');
+ setattachment(this.chatbubbleentity, this, ""); // sticks to moving player better, also conserves bandwidth
+ this.chatbubbleentity.mdl = this.chatbubbleentity.model;
+ //this.chatbubbleentity.model = "";
+ this.chatbubbleentity.effects = EF_LOWPRECISION;
}
}
/*void UpdateColorModHack()
{
float c;
- c = self.clientcolors & 15;
+ c = this.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
- if (!teamplay) self.colormod = '0 0 0';
- else if (c == 0) self.colormod = '1.00 1.00 1.00';
- else if (c == 3) self.colormod = '0.10 1.73 0.10';
- else if (c == 4) self.colormod = '1.73 0.10 0.10';
- else if (c == 12) self.colormod = '1.22 1.22 0.10';
- else if (c == 13) self.colormod = '0.10 0.10 1.73';
- else self.colormod = '1 1 1';
+ if (!teamplay) this.colormod = '0 0 0';
+ else if (c == 0) this.colormod = '1.00 1.00 1.00';
+ else if (c == 3) this.colormod = '0.10 1.73 0.10';
+ else if (c == 4) this.colormod = '1.73 0.10 0.10';
+ else if (c == 12) this.colormod = '1.22 1.22 0.10';
+ else if (c == 13) this.colormod = '0.10 0.10 1.73';
+ else this.colormod = '1 1 1';
}*/
void respawn()
{SELFPARAM();
- if(self.alpha >= 0 && autocvar_g_respawn_ghosts)
- {
- self.solid = SOLID_NOT;
- self.takedamage = DAMAGE_NO;
- self.movetype = MOVETYPE_FLY;
- self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
- self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
- self.effects |= CSQCMODEL_EF_RESPAWNGHOST;
- Send_Effect(EFFECT_RESPAWN_GHOST, self.origin, '0 0 0', 1);
+ if(this.alpha >= 0 && autocvar_g_respawn_ghosts)
+ {
+ this.solid = SOLID_NOT;
+ this.takedamage = DAMAGE_NO;
+ this.movetype = MOVETYPE_FLY;
+ this.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
+ this.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
+ this.effects |= CSQCMODEL_EF_RESPAWNGHOST;
+ Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1);
if(autocvar_g_respawn_ghosts_maxtime)
- SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
+ SUB_SetFade (this, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
}
- CopyBody(self, 1);
+ CopyBody(this, 1);
- self.effects |= EF_NODRAW; // prevent another CopyBody
+ this.effects |= EF_NODRAW; // prevent another CopyBody
PutClientInServer();
}
-void play_countdown(float finished, string samp)
+void play_countdown(float finished, Sound samp)
{SELFPARAM();
- if(IS_REAL_CLIENT(self))
+ TC(Sound, samp);
+ if(IS_REAL_CLIENT(this))
if(floor(finished - time - frametime) != floor(finished - time))
if(finished - time < 6)
- _sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
}
void player_powerups ()
{SELFPARAM();
// add a way to see what the items were BEFORE all of these checks for the mutator hook
- int items_prev = self.items;
+ int items_prev = this.items;
- if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover)
- self.modelflags |= MF_ROCKET;
+ if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !gameover)
+ this.modelflags |= MF_ROCKET;
else
- self.modelflags &= ~MF_ROCKET;
+ this.modelflags &= ~MF_ROCKET;
- self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
+ this.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
- if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed
+ if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
return;
- Fire_ApplyDamage(self);
- Fire_ApplyEffect(self);
+ Fire_ApplyDamage(this);
+ Fire_ApplyEffect(this);
if (!g_instagib)
{
- if (self.items & ITEM_Strength.m_itemid)
+ if (this.items & ITEM_Strength.m_itemid)
{
- play_countdown(self.strength_finished, SND(POWEROFF));
- self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > self.strength_finished)
+ play_countdown(this.strength_finished, SND_POWEROFF);
+ this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time > this.strength_finished)
{
- self.items = self.items - (self.items & ITEM_Strength.m_itemid);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
+ this.items = this.items - (this.items & ITEM_Strength.m_itemid);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
}
}
else
{
- if (time < self.strength_finished)
+ if (time < this.strength_finished)
{
- self.items = self.items | ITEM_Strength.m_itemid;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH);
+ this.items = this.items | ITEM_Strength.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_STRENGTH);
}
}
- if (self.items & ITEM_Shield.m_itemid)
+ if (this.items & ITEM_Shield.m_itemid)
{
- play_countdown(self.invincible_finished, SND(POWEROFF));
- self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > self.invincible_finished)
+ play_countdown(this.invincible_finished, SND_POWEROFF);
+ this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time > this.invincible_finished)
{
- self.items = self.items - (self.items & ITEM_Shield.m_itemid);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
+ this.items = this.items - (this.items & ITEM_Shield.m_itemid);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
}
}
else
{
- if (time < self.invincible_finished)
+ if (time < this.invincible_finished)
{
- self.items = self.items | ITEM_Shield.m_itemid;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD);
+ this.items = this.items | ITEM_Shield.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_SHIELD);
}
}
- if (self.items & IT_SUPERWEAPON)
+ if (this.items & IT_SUPERWEAPON)
{
- if (!(self.weapons & WEPSET_SUPERWEAPONS))
+ if (!(this.weapons & WEPSET_SUPERWEAPONS))
{
- self.superweapons_finished = 0;
- self.items = self.items - (self.items & IT_SUPERWEAPON);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
+ this.superweapons_finished = 0;
+ this.items = this.items - (this.items & IT_SUPERWEAPON);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
}
- else if (self.items & IT_UNLIMITED_SUPERWEAPONS)
+ else if (this.items & IT_UNLIMITED_SUPERWEAPONS)
{
// don't let them run out
}
else
{
- play_countdown(self.superweapons_finished, SND(POWEROFF));
- if (time > self.superweapons_finished)
+ play_countdown(this.superweapons_finished, SND_POWEROFF);
+ if (time > this.superweapons_finished)
{
- self.items = self.items - (self.items & IT_SUPERWEAPON);
- self.weapons &= ~WEPSET_SUPERWEAPONS;
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
+ this.items = this.items - (this.items & IT_SUPERWEAPON);
+ this.weapons &= ~WEPSET_SUPERWEAPONS;
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
}
}
}
- else if(self.weapons & WEPSET_SUPERWEAPONS)
+ else if(this.weapons & WEPSET_SUPERWEAPONS)
{
- if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
+ if (time < this.superweapons_finished || (this.items & IT_UNLIMITED_SUPERWEAPONS))
{
- self.items = self.items | IT_SUPERWEAPON;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
+ this.items = this.items | IT_SUPERWEAPON;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
}
else
{
- self.superweapons_finished = 0;
- self.weapons &= ~WEPSET_SUPERWEAPONS;
+ this.superweapons_finished = 0;
+ this.weapons &= ~WEPSET_SUPERWEAPONS;
}
}
else
{
- self.superweapons_finished = 0;
+ this.superweapons_finished = 0;
}
}
if(autocvar_g_nodepthtestplayers)
- self.effects = self.effects | EF_NODEPTHTEST;
+ this.effects = this.effects | EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- self.effects = self.effects | EF_FULLBRIGHT;
+ this.effects = this.effects | EF_FULLBRIGHT;
if (time >= game_starttime)
- if (time < self.spawnshieldtime)
- self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time < this.spawnshieldtime)
+ this.effects = this.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
- MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev);
+ MUTATOR_CALLHOOK(PlayerPowerups, this, items_prev);
}
float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
regen_health_stable = autocvar_g_balance_health_regenstable;
regen_health_rotstable = autocvar_g_balance_health_rotstable;
if(!MUTATOR_CALLHOOK(PlayerRegen))
- if(!STAT(FROZEN, self))
+ if(!STAT(FROZEN, this))
{
float mina, maxa, limith, limita;
maxa = autocvar_g_balance_armor_rotstable;
limith = limith * limit_mod;
limita = limita * limit_mod;
- self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
- self.health = CalcRotRegen(self.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > self.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith);
+ this.armorvalue = CalcRotRegen(this.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > this.pauserotarmor_finished), limita);
+ this.health = CalcRotRegen(this.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > this.pauserothealth_finished), limith);
}
// if player rotted to death... die!
// check this outside above checks, as player may still be able to rot to death
- if(self.health < 1)
+ if(this.health < 1)
{
- if(self.vehicle)
+ if(this.vehicle)
vehicles_exit(VHEF_RELEASE);
- if(self.event_damage)
- self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ if(this.event_damage)
+ this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0');
}
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if (!(this.items & IT_UNLIMITED_WEAPON_AMMO))
{
float minf, maxf, limitf;
minf = autocvar_g_balance_fuel_regenstable;
limitf = autocvar_g_balance_fuel_limit;
- self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+ this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
}
}
-float zoomstate_set;
+bool zoomstate_set;
void SetZoomState(float z)
{SELFPARAM();
- if(z != self.zoomstate)
+ if(z != this.zoomstate)
{
- self.zoomstate = z;
- ClientData_Touch(self);
+ this.zoomstate = z;
+ ClientData_Touch(this);
}
- zoomstate_set = 1;
+ zoomstate_set = true;
}
void GetPressedKeys()
void SpectateCopy(entity this, entity spectatee)
{
+ TC(Client, this); TC(Client, spectatee);
+
MUTATOR_CALLHOOK(SpectateCopy, spectatee, this);
PS(this) = PS(spectatee);
this.armortype = spectatee.armortype;
setsize(this, spectatee.mins, spectatee.maxs);
SetZoomState(spectatee.zoomstate);
- anticheat_spectatecopy(spectatee);
+ anticheat_spectatecopy(this, spectatee);
this.hud = spectatee.hud;
if(spectatee.vehicle)
{
bool SpectateUpdate()
{SELFPARAM();
- if(!self.enemy)
+ if(!this.enemy)
return false;
- if(!IS_PLAYER(self.enemy) || self == self.enemy)
+ if(!IS_PLAYER(this.enemy) || this == this.enemy)
{
- SetSpectatee(self, NULL);
+ SetSpectatee(this, NULL);
return false;
}
bool SpectateSet()
{SELFPARAM();
- if(!IS_PLAYER(self.enemy))
+ if(!IS_PLAYER(this.enemy))
return false;
- msg_entity = self;
+ msg_entity = this;
WriteByte(MSG_ONE, SVC_SETVIEW);
- WriteEntity(MSG_ONE, self.enemy);
- self.movetype = MOVETYPE_NONE;
- accuracy_resend(self);
+ WriteEntity(MSG_ONE, this.enemy);
+ this.movetype = MOVETYPE_NONE;
+ accuracy_resend(this);
if(!SpectateUpdate())
PutObserverInServer();
bool Spectate(entity pl)
{SELFPARAM();
- if(MUTATOR_CALLHOOK(SpectateSet, self, pl))
+ if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
return false;
pl = spec_player;
- SetSpectatee(self, pl);
+ SetSpectatee(this, pl);
return SpectateSet();
}
bool SpectateNext()
{SELFPARAM();
- other = find(self.enemy, classname, STR_PLAYER);
+ other = find(this.enemy, classname, STR_PLAYER);
- if (MUTATOR_CALLHOOK(SpectateNext, self, other))
+ if (MUTATOR_CALLHOOK(SpectateNext, this, other))
other = spec_player;
else if (!other)
other = find(other, classname, STR_PLAYER);
- if(other) { SetSpectatee(self, other); }
+ if(other) { SetSpectatee(this, other); }
return SpectateSet();
}
entity first = other;
// skip players until current spectated player
- if(self.enemy)
- while(other && other != self.enemy)
+ if(this.enemy)
+ while(other && other != this.enemy)
other = other.chain;
- switch (MUTATOR_CALLHOOK(SpectatePrev, self, other, first))
+ switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first))
{
case MUT_SPECPREV_FOUND:
other = spec_player;
}
}
- SetSpectatee(self, other);
+ SetSpectatee(this, other);
return SpectateSet();
}
void ShowRespawnCountdown()
{SELFPARAM();
float number;
- if(!IS_DEAD(self)) // just respawned?
+ if(!IS_DEAD(this)) // just respawned?
return;
else
{
- number = ceil(self.respawn_time - time);
+ number = ceil(this.respawn_time - time);
if(number <= 0)
return;
- if(number <= self.respawn_countdown)
+ if(number <= this.respawn_countdown)
{
- self.respawn_countdown = number - 1;
- if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
- { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
+ this.respawn_countdown = number - 1;
+ if(ceil(this.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
+ { Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
}
}
}
void LeaveSpectatorMode()
{SELFPARAM();
- if(self.caplayer)
+ if(this.caplayer)
return;
- if(nJoinAllowed(self, self))
+ if(nJoinAllowed(this, this))
{
- if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0)
+ if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
{
- self.classname = STR_PLAYER;
+ TRANSMUTE(Player, this);
if(autocvar_g_campaign || autocvar_g_balance_teams)
- { JoinBestTeam(self, false, true); }
+ { JoinBestTeam(this, false, true); }
if(autocvar_g_campaign)
- { campaign_bots_may_start = 1; }
+ { campaign_bots_may_start = true; }
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
PutClientInServer();
- if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
+ if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
}
else
- stuffcmd(self, "menu_showteamselect\n");
+ stuffcmd(this, "menu_showteamselect\n");
}
else
{
// Player may not join because g_maxplayers is set
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
}
}
*/
void checkSpectatorBlock()
{SELFPARAM();
- if(IS_SPEC(self) || IS_OBSERVER(self))
- if(!self.caplayer)
- if(IS_REAL_CLIENT(self))
+ if(IS_SPEC(this) || IS_OBSERVER(this))
+ if(!this.caplayer)
+ if(IS_REAL_CLIENT(this))
{
- if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
- dropclient(self);
+ if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
+ dropclient(this);
}
}
}
-void PrintWelcomeMessage()
-{SELFPARAM();
- if(self.motd_actived_time == 0)
+void PrintWelcomeMessage(entity this)
+{
+ if(this.motd_actived_time == 0)
{
if (autocvar_g_campaign) {
- if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
- self.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
+ if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
+ this.motd_actived_time = time;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
}
} else {
- if (PHYS_INPUT_BUTTON_INFO(self)) {
- self.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+ if (PHYS_INPUT_BUTTON_INFO(this)) {
+ this.motd_actived_time = time;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
}
}
}
- else if(self.motd_actived_time > 0) // showing MOTD or campaign message
+ else if(this.motd_actived_time > 0) // showing MOTD or campaign message
{
if (autocvar_g_campaign) {
- if (PHYS_INPUT_BUTTON_INFO(self))
- self.motd_actived_time = time;
- else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ if (PHYS_INPUT_BUTTON_INFO(this))
+ this.motd_actived_time = time;
+ else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
} else {
- if (PHYS_INPUT_BUTTON_INFO(self))
- self.motd_actived_time = time;
- else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ if (PHYS_INPUT_BUTTON_INFO(this))
+ this.motd_actived_time = time;
+ else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
}
}
- else //if(self.motd_actived_time < 0) // just connected, motd is active
+ else //if(this.motd_actived_time < 0) // just connected, motd is active
{
- if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
- self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
- else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
+ if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
+ this.motd_actived_time = -2; // wait until BUTTON_INFO gets released
+ else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
{
// instanctly hide MOTD
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
}
}
void ObserverThink()
{SELFPARAM();
- if ( self.impulse )
+ if ( this.impulse )
{
- MinigameImpulse(self, self.impulse);
- self.impulse = 0;
+ MinigameImpulse(this, this.impulse);
+ this.impulse = 0;
}
float prefered_movetype;
- if (self.flags & FL_JUMPRELEASED) {
- if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
- self.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
+ if (this.flags & FL_JUMPRELEASED) {
+ if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
+ this.flags |= FL_SPAWNING;
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
- self.classname = STR_SPECTATOR;
+ TRANSMUTE(Spectator, this);
}
} else {
- prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
- if (self.movetype != prefered_movetype)
- self.movetype = prefered_movetype;
+ prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+ if (this.movetype != prefered_movetype)
+ this.movetype = prefered_movetype;
}
} else {
- if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
- self.flags |= FL_JUMPRELEASED;
- if(self.flags & FL_SPAWNING)
+ if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this))) {
+ this.flags |= FL_JUMPRELEASED;
+ if(this.flags & FL_SPAWNING)
{
- self.flags &= ~FL_SPAWNING;
+ this.flags &= ~FL_SPAWNING;
LeaveSpectatorMode();
return;
}
void SpectatorThink()
{SELFPARAM();
- if ( self.impulse )
+ if ( this.impulse )
{
- if(MinigameImpulse(self, self.impulse))
- self.impulse = 0;
- }
- if (self.flags & FL_JUMPRELEASED) {
- if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
- self.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
- self.flags &= ~FL_JUMPRELEASED;
+ if(MinigameImpulse(this, this.impulse))
+ this.impulse = 0;
+ }
+ if (this.flags & FL_JUMPRELEASED) {
+ if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
+ this.flags |= FL_SPAWNING;
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
- self.classname = STR_SPECTATOR;
+ TRANSMUTE(Spectator, this);
} else {
- self.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
PutClientInServer();
}
- self.impulse = 0;
- } else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19 || (self.impulse >= 220 && self.impulse <= 229)) {
- self.flags &= ~FL_JUMPRELEASED;
+ this.impulse = 0;
+ } else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectatePrev()) {
- self.classname = STR_SPECTATOR;
+ TRANSMUTE(Spectator, this);
} else {
- self.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
PutClientInServer();
}
- self.impulse = 0;
- } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
- self.flags &= ~FL_JUMPRELEASED;
- self.classname = STR_OBSERVER;
+ this.impulse = 0;
+ } else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
+ this.flags &= ~FL_JUMPRELEASED;
+ TRANSMUTE(Observer, this);
PutClientInServer();
} else {
if(!SpectateUpdate())
PutObserverInServer();
}
} else {
- if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
- self.flags |= FL_JUMPRELEASED;
- if(self.flags & FL_SPAWNING)
+ if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) {
+ this.flags |= FL_JUMPRELEASED;
+ if(this.flags & FL_SPAWNING)
{
- self.flags &= ~FL_SPAWNING;
+ this.flags &= ~FL_SPAWNING;
LeaveSpectatorMode();
return;
}
PutObserverInServer();
}
- self.flags |= FL_CLIENT | FL_NOTARGET;
+ this.flags |= FL_CLIENT | FL_NOTARGET;
}
void vehicles_enter (entity pl, entity veh);
void PlayerUseKey()
{SELFPARAM();
- if (!IS_PLAYER(self))
+ if (!IS_PLAYER(this))
return;
- if(self.vehicle)
+ if(this.vehicle)
{
if(!gameover)
{
}
else if(autocvar_g_vehicles_enter)
{
- if(!STAT(FROZEN, self))
- if(!IS_DEAD(self))
+ if(!STAT(FROZEN, this))
+ if(!IS_DEAD(this))
if(!gameover)
{
entity head, closest_target = world;
- head = WarpZone_FindRadius(self.origin, autocvar_g_vehicles_enter_radius, true);
+ head = WarpZone_FindRadius(this.origin, autocvar_g_vehicles_enter_radius, true);
while(head) // find the closest acceptable target to enter
{
if(head.vehicle_flags & VHF_ISVEHICLE)
if(!IS_DEAD(head))
- if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, self)))
+ if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this)))
if(head.takedamage != DAMAGE_NO)
{
if(closest_target)
{
- if(vlen(self.origin - head.origin) < vlen(self.origin - closest_target.origin))
+ if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin))
{ closest_target = head; }
}
else { closest_target = head; }
head = head.chain;
}
- if(closest_target) { vehicles_enter(self, closest_target); return; }
+ if(closest_target) { vehicles_enter(this, closest_target); return; }
}
}
.float last_vehiclecheck;
.int items_added;
void PlayerPreThink ()
-{SELFPARAM();
- WarpZone_PlayerPhysics_FixVAngle();
+{
+ SELFPARAM();
+ WarpZone_PlayerPhysics_FixVAngle(this);
- self.stat_game_starttime = game_starttime;
- self.stat_round_starttime = round_starttime;
- self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam;
- self.stat_leadlimit = autocvar_leadlimit;
+ STAT(GAMESTARTTIME, this) = game_starttime;
+ STAT(ROUNDSTARTTIME, this) = round_starttime;
+ STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
+ STAT(LEADLIMIT, this) = autocvar_leadlimit;
- self.weaponsinmap = weaponsInMap;
+ STAT(WEAPONSINMAP, this) = weaponsInMap;
- if(frametime)
- {
+ if (frametime) {
// physics frames: update anticheat stuff
- anticheat_prethink();
+ anticheat_prethink(this);
}
- if(blockSpectators && frametime)
- // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+ if (blockSpectators && frametime) {
+ // WORKAROUND: only use dropclient in server frames (frametime set).
+ // Never use it in cl_movement frames (frametime zero).
checkSpectatorBlock();
+ }
- zoomstate_set = 0;
-
- // Savage: Check for nameless players
- if (isInvisibleString(self.netname)) {
- string new_name = strzone(strcat("Player@", ftos(self.playerid)));
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", new_name));
- if(self.netname_previous)
- strunzone(self.netname_previous);
- self.netname_previous = strzone(new_name);
- self.netname = self.netname_previous;
- // stuffcmd(self, strcat("name ", self.netname, "\n"));
- } else if(self.netname_previous != self.netname) {
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname));
- if(self.netname_previous)
- strunzone(self.netname_previous);
- self.netname_previous = strzone(self.netname);
+ zoomstate_set = false;
+
+ // Check for nameless players
+ if (isInvisibleString(this.netname)) {
+ this.netname = strzone(sprintf("Player#%d", this.playerid));
+ // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
+ }
+ if (this.netname != this.netname_previous) {
+ if (autocvar_sv_eventlog) {
+ GameLogEcho(strcat(":name:", ftos(this.playerid), ":", this.netname));
+ }
+ if (this.netname_previous) strunzone(this.netname_previous);
+ this.netname_previous = strzone(this.netname);
}
// version nagging
- if(self.version_nagtime)
- if(self.cvar_g_xonoticversion)
- if(time > self.version_nagtime)
- {
- // don't notify git users
- if(strstr(self.cvar_g_xonoticversion, "git", 0) < 0 && strstr(self.cvar_g_xonoticversion, "autobuild", 0) < 0)
- {
- if(strstr(autocvar_g_xonoticversion, "git", 0) >= 0 || strstr(autocvar_g_xonoticversion, "autobuild", 0) >= 0)
- {
- // notify release users if connecting to git
- LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- else
- {
- float r;
- r = vercmp(self.cvar_g_xonoticversion, autocvar_g_xonoticversion);
- if(r < 0)
- {
- // give users new version
- LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- else if(r > 0)
- {
- // notify users about old server version
- LOG_INFO("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- }
- }
- self.version_nagtime = 0;
- }
+ if (this.version_nagtime && this.cvar_g_xonoticversion && time > this.version_nagtime) {
+ this.version_nagtime = 0;
+ if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ // git client
+ } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ // git server
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ } else {
+ int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+ if (r < 0) { // old client
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ } else if (r > 0) { // old server
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ }
+ }
+ }
// GOD MODE info
- if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
+ if (!(this.flags & FL_GODMODE) && this.max_armorvalue)
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_GODMODE_OFF, self.max_armorvalue);
- self.max_armorvalue = 0;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_GODMODE_OFF, this.max_armorvalue);
+ this.max_armorvalue = 0;
}
- if(STAT(FROZEN, self) == 2)
+ if (STAT(FROZEN, this) == 2)
{
- self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
- self.health = max(1, self.revive_progress * start_health);
- self.iceblock.alpha = bound(0.2, 1 - self.revive_progress, 1);
+ this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+ this.health = max(1, this.revive_progress * start_health);
+ this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
- if(self.revive_progress >= 1)
- Unfreeze(self);
+ if (this.revive_progress >= 1)
+ Unfreeze(this);
}
- else if(STAT(FROZEN, self) == 3)
+ else if (STAT(FROZEN, this) == 3)
{
- self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
- self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
+ this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+ this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
- if(self.health < 1)
+ if (this.health < 1)
{
- if(self.vehicle)
+ if (this.vehicle)
vehicles_exit(VHEF_RELEASE);
- self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+ this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
}
- else if ( self.revive_progress <= 0 )
- Unfreeze(self);
+ else if (this.revive_progress <= 0)
+ Unfreeze(this);
}
MUTATOR_CALLHOOK(PlayerPreThink);
if(autocvar_g_vehicles_enter)
- if(time > self.last_vehiclecheck)
- if(IS_PLAYER(self))
+ if(time > this.last_vehiclecheck)
+ if(IS_PLAYER(this))
if(!gameover)
- if(!STAT(FROZEN, self))
- if(!self.vehicle)
- if(!IS_DEAD(self))
+ if(!STAT(FROZEN, this))
+ if(!this.vehicle)
+ if(!IS_DEAD(this))
{
entity veh;
for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
- if(vlen(veh.origin - self.origin) < autocvar_g_vehicles_enter_radius)
+ if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius)
if(!IS_DEAD(veh))
if(veh.takedamage != DAMAGE_NO)
- if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, self))
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
+ if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this))
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
else if(!veh.owner)
- if(!veh.team || SAME_TEAM(self, veh))
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER);
+ if(!veh.team || SAME_TEAM(this, veh))
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER);
else if(autocvar_g_vehicles_steal)
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
- self.last_vehiclecheck = time + 1;
+ this.last_vehiclecheck = time + 1;
}
- if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+ if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
{
- if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
+ if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed)
PlayerUseKey();
- self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
+ this.usekeypressed = PHYS_INPUT_BUTTON_USE(this);
}
- if(IS_REAL_CLIENT(self))
- PrintWelcomeMessage();
-
- if(IS_PLAYER(self))
- {
+ if (IS_REAL_CLIENT(this))
+ PrintWelcomeMessage(this);
+ if (IS_PLAYER(this)) {
CheckRules_Player();
- if (intermission_running)
- {
- IntermissionThink (); // otherwise a button could be missed between
- return; // the think tics
+ if (intermission_running) {
+ IntermissionThink();
+ return;
}
- //don't allow the player to turn around while game is paused!
- if(timeout_status == TIMEOUT_ACTIVE) {
+ if (timeout_status == TIMEOUT_ACTIVE) {
+ // don't allow the player to turn around while game is paused
// FIXME turn this into CSQC stuff
- self.v_angle = self.lastV_angle;
- self.angles = self.lastV_angle;
- self.fixangle = true;
+ this.v_angle = this.lastV_angle;
+ this.angles = this.lastV_angle;
+ this.fixangle = true;
}
- if(frametime)
- {
- player_powerups();
- }
+ if (frametime) player_powerups();
- if (IS_DEAD(self))
- {
- if(self.personal && g_race_qualifying)
- {
- if(time > self.respawn_time)
- {
- self.respawn_time = time + 1; // only retry once a second
- self.stat_respawn_time = self.respawn_time;
+ if (IS_DEAD(this)) {
+ if (this.personal && g_race_qualifying) {
+ if (time > this.respawn_time) {
+ STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
respawn();
- self.impulse = 141;
- }
- }
- else
- {
- float button_pressed;
- if(frametime)
- player_anim();
- button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
-
- if (self.deadflag == DEAD_DYING)
- {
- if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
- self.deadflag = DEAD_RESPAWNING;
- else if(!button_pressed)
- self.deadflag = DEAD_DEAD;
+ this.impulse = CHIMPULSE_SPEEDRUN.impulse;
}
- else if (self.deadflag == DEAD_DEAD)
- {
- if(button_pressed)
- self.deadflag = DEAD_RESPAWNABLE;
- else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
- self.deadflag = DEAD_RESPAWNING;
- }
- else if (self.deadflag == DEAD_RESPAWNABLE)
- {
- if(!button_pressed)
- self.deadflag = DEAD_RESPAWNING;
- }
- else if (self.deadflag == DEAD_RESPAWNING)
- {
- if(time > self.respawn_time)
- {
- self.respawn_time = time + 1; // only retry once a second
- self.respawn_time_max = self.respawn_time;
+ } else {
+ if (frametime) player_anim();
+ bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
+
+ if (this.deadflag == DEAD_DYING) {
+ if ((this.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max) {
+ this.deadflag = DEAD_RESPAWNING;
+ } else if (!button_pressed) {
+ this.deadflag = DEAD_DEAD;
+ }
+ } else if (this.deadflag == DEAD_DEAD) {
+ if (button_pressed) {
+ this.deadflag = DEAD_RESPAWNABLE;
+ } else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) {
+ this.deadflag = DEAD_RESPAWNING;
+ }
+ } else if (this.deadflag == DEAD_RESPAWNABLE) {
+ if (!button_pressed) {
+ this.deadflag = DEAD_RESPAWNING;
+ }
+ } else if (this.deadflag == DEAD_RESPAWNING) {
+ if (time > this.respawn_time) {
+ this.respawn_time = time + 1; // only retry once a second
+ this.respawn_time_max = this.respawn_time;
respawn();
}
}
ShowRespawnCountdown();
- if(self.respawn_flags & RESPAWN_SILENT)
- self.stat_respawn_time = 0;
- else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
- self.stat_respawn_time = self.respawn_time_max;
+ if (this.respawn_flags & RESPAWN_SILENT)
+ STAT(RESPAWN_TIME, this) = 0;
+ else if ((this.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+ STAT(RESPAWN_TIME, this) = this.respawn_time_max;
else
- self.stat_respawn_time = self.respawn_time;
+ STAT(RESPAWN_TIME, this) = this.respawn_time;
}
// if respawning, invert stat_respawn_time to indicate this, the client translates it
- if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0)
- self.stat_respawn_time *= -1;
+ if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
+ STAT(RESPAWN_TIME, this) *= -1;
return;
}
- self.prevorigin = self.origin;
-
- float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
- if(self.hook.state)
- do_crouch = 0;
- if(self.vehicle)
- do_crouch = 0;
- if(STAT(FROZEN, self))
- do_crouch = 0;
+ this.prevorigin = this.origin;
- // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
- // It cannot be predicted by the engine!
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- if((PS(self).m_weapon == WEP_SHOCKWAVE || PS(self).m_weapon == WEP_SHOTGUN) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
- do_crouch = 0;
+ bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+ if (this.hook.state) {
+ do_crouch = false;
+ } else if (this.vehicle) {
+ do_crouch = false;
+ } else if (STAT(FROZEN, this)) {
+ do_crouch = false;
+ } else if ((PS(this).m_weapon == WEP_SHOTGUN || PS(this).m_weapon == WEP_SHOCKWAVE) && this.(weaponentity).wframe == WFRAME_FIRE2 && time < this.(weaponentity).weapon_nextthink) {
+ // WEAPONTODO: predict
+ do_crouch = false;
+ }
- if (do_crouch)
- {
- if (!self.crouch)
- {
- self.crouch = true;
- self.view_ofs = STAT(PL_CROUCH_VIEW_OFS, self);
- setsize (self, STAT(PL_CROUCH_MIN, self), STAT(PL_CROUCH_MAX, self));
- // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway
- }
- }
- else
- {
- if (self.crouch)
- {
- tracebox(self.origin, STAT(PL_MIN, self), STAT(PL_MAX, self), self.origin, false, self);
- if (!trace_startsolid)
- {
- self.crouch = false;
- self.view_ofs = STAT(PL_VIEW_OFS, self);
- setsize (self, STAT(PL_MIN, self), STAT(PL_MAX, self));
- }
+ if (do_crouch) {
+ if (!this.crouch) {
+ this.crouch = true;
+ this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+ setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
+ // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
}
+ } else if (this.crouch) {
+ tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+ if (!trace_startsolid) {
+ this.crouch = false;
+ this.view_ofs = STAT(PL_VIEW_OFS, this);
+ setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+ }
}
- FixPlayermodel(self);
+ FixPlayermodel(this);
// LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
//if(frametime)
{
- self.items &= ~self.items_added;
+ this.items &= ~this.items_added;
- W_WeaponFrame(self);
+ W_WeaponFrame(this);
- self.items_added = 0;
- if(self.items & ITEM_Jetpack.m_itemid)
- if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01)
- self.items_added |= IT_FUEL;
+ this.items_added = 0;
+ if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))
+ this.items_added |= IT_FUEL;
- self.items |= self.items_added;
+ this.items |= this.items_added;
}
player_regen();
// WEAPONTODO: Add a weapon request for this
// rot vortex charge to the charge limit
- if(WEP_CVAR(vortex, charge_rot_rate) && self.vortex_charge > WEP_CVAR(vortex, charge_limit) && self.vortex_charge_rottime < time)
- self.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), self.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+ if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time)
+ this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
- if(frametime)
- player_anim();
+ if (frametime) player_anim();
// secret status
secrets_setstatus();
// monsters status
- monsters_setstatus(self);
-
- self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ monsters_setstatus(this);
- //self.angles_y=self.v_angle_y + 90; // temp
- } else if(gameover) {
- if (intermission_running)
- IntermissionThink (); // otherwise a button could be missed between
+ this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ }
+ else if (gameover) {
+ if (intermission_running) IntermissionThink();
return;
- } else if(IS_OBSERVER(self)) {
+ }
+ else if (IS_OBSERVER(this)) {
ObserverThink();
- } else if(IS_SPEC(self)) {
+ }
+ else if (IS_SPEC(this)) {
SpectatorThink();
}
// WEAPONTODO: Add weapon request for this
- if(!zoomstate_set)
+ if (!zoomstate_set) {
SetZoomState(
- PHYS_INPUT_BUTTON_ZOOM(self)
- || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
- || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
- || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
- ); // WEAPONTODO
-
- float oldspectatee_status;
- oldspectatee_status = self.spectatee_status;
- if(IS_SPEC(self))
- self.spectatee_status = etof(self.enemy);
- else if(IS_OBSERVER(self))
- self.spectatee_status = etof(self);
- else
- self.spectatee_status = 0;
- if(self.spectatee_status != oldspectatee_status)
- {
- ClientData_Touch(self);
- if(g_race || g_cts)
- race_InitSpectator();
+ PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this)
+ || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX)
+ || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+ );
+ }
+
+ int oldspectatee_status = this.spectatee_status;
+ if (IS_SPEC(this)) {
+ this.spectatee_status = etof(this.enemy);
+ } else if (IS_OBSERVER(this)) {
+ this.spectatee_status = etof(this);
+ } else {
+ this.spectatee_status = 0;
+ }
+ if (this.spectatee_status != oldspectatee_status) {
+ ClientData_Touch(this);
+ if (g_race || g_cts) race_InitSpectator();
}
- if(self.teamkill_soundtime)
- if(time > self.teamkill_soundtime)
+ if (this.teamkill_soundtime && time > this.teamkill_soundtime)
{
- self.teamkill_soundtime = 0;
+ this.teamkill_soundtime = 0;
- entity e = self.teamkill_soundsource;
+ entity e = this.teamkill_soundsource;
entity oldpusher = e.pusher;
e.pusher = this;
PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY);
e.pusher = oldpusher;
}
- if(self.taunt_soundtime)
- if(time > self.taunt_soundtime)
- {
- self.taunt_soundtime = 0;
- PlayerSound(self, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
+ if (this.taunt_soundtime && time > this.taunt_soundtime) {
+ this.taunt_soundtime = 0;
+ PlayerSound(this, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
}
- target_voicescript_next(self);
+ target_voicescript_next(this);
// WEAPONTODO: Move into weaponsystem somehow
// if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
- if (PS(self).m_weapon == WEP_Null)
- self.clip_load = self.clip_size = 0;
+ if (PS(this).m_weapon == WEP_Null)
+ this.clip_load = this.clip_size = 0;
}
void DrownPlayer(entity this)
*/
.float idlekick_lasttimeleft;
void PlayerPostThink ()
-{SELFPARAM();
- if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
- if(IS_REAL_CLIENT(self))
- if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
+{
+ SELFPARAM();
+ if (sv_maxidle > 0)
+ if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+ if (IS_REAL_CLIENT(this))
+ if (IS_PLAYER(this) || sv_maxidle_spectatorsareidle)
{
- if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10
+ if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
{
- if(self.idlekick_lasttimeleft)
+ if (this.idlekick_lasttimeleft)
{
- self.idlekick_lasttimeleft = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
+ this.idlekick_lasttimeleft = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
}
}
else
{
- float timeleft;
- timeleft = ceil(sv_maxidle - (time - self.parm_idlesince));
- if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10
- {
- if(!self.idlekick_lasttimeleft)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
+ float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+ if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
+ if (!this.idlekick_lasttimeleft)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
}
- if(timeleft <= 0)
- {
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, self.netname);
- dropclient(self);
+ if (timeleft <= 0) {
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname);
+ dropclient(this);
return;
}
- else if(timeleft <= 10)
- {
- if(timeleft != self.idlekick_lasttimeleft)
- { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
- self.idlekick_lasttimeleft = timeleft;
+ else if (timeleft <= 10) {
+ if (timeleft != this.idlekick_lasttimeleft) {
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
+ }
+ this.idlekick_lasttimeleft = timeleft;
}
}
}
//CheckPlayerJump();
- if(IS_PLAYER(self)) {
- DrownPlayer(self);
+ if (IS_PLAYER(this)) {
+ DrownPlayer(this);
CheckRules_Player();
UpdateChatBubble();
- if (self.impulse)
- ImpulseCommands(self);
- if (intermission_running)
- return; // intermission or finale
+ if (this.impulse) ImpulseCommands(this);
+ if (intermission_running) return; // intermission or finale
GetPressedKeys();
}
- /*
- float i;
- for(i = 0; i < 1000; ++i)
- {
- vector end;
- end = self.origin + '0 0 1024' + 512 * randomvec();
- tracebox(self.origin, self.mins, self.maxs, end, MOVE_NORMAL, self);
- if(trace_fraction < 1)
- if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
- {
- print("I HIT SOLID: ", vtos(self.origin), " -> ", vtos(end), "\n");
- break;
- }
- }
- */
-
- if(self.waypointsprite_attachedforcarrier)
- WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
+ if (this.waypointsprite_attachedforcarrier) {
+ vector v = healtharmor_maxdamage(this.health, this.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id);
+ WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, '1 0 0' * v);
+ }
playerdemo_write();
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
-#ifndef CL_CLIENT_H
-#define CL_CLIENT_H
+#pragma once
+
+void ClientState_attach(entity this);
+
+CLASS(Client, Object)
+ /** Client name */
+ ATTRIB(Client, netname, string, this.netname)
+ ATTRIB(Client, colormap, int, this.colormap)
+ ATTRIB(Client, team, int, this.team)
+ ATTRIB(Client, clientcolors, int, this.clientcolors)
+ /** Client IP */
+ ATTRIB(Client, netaddress, string, this.netaddress)
+ ATTRIB(Client, playermodel, string, this.playermodel)
+ ATTRIB(Client, playerskin, int, this.playerskin)
+
+ /** fingerprint of CA key the player used to authenticate */
+ ATTRIB(Client, crypto_keyfp, string, this.crypto_keyfp)
+ /** fingerprint of CA key the server used to authenticate to the player */
+ ATTRIB(Client, crypto_mykeyfp, string, this.crypto_mykeyfp)
+ /** fingerprint of ID used by the player entity, or string_null if not identified */
+ ATTRIB(Client, crypto_idfp, string, this.crypto_idfp)
+ /** set if the player's ID has been signed */
+ ATTRIB(Client, crypto_idfp_signed, bool, this.crypto_idfp_signed)
+ /** the string "AES128" if encrypting, and string_null if plaintext */
+ ATTRIB(Client, crypto_encryptmethod, string, this.crypto_encryptmethod)
+ /** the string "HMAC-SHA256" if signing, and string_null if plaintext */
+ ATTRIB(Client, crypto_signmethod, string, this.crypto_signmethod)
+
+ // custom
+
+ ATTRIB(Client, playerid, int, this.playerid)
+
+ METHOD(Client, m_unwind, bool(Client this));
+
+ STATIC_METHOD(Client, Add, void(Client this, int _team));
+ STATIC_METHOD(Client, Remove, void(Client this));
+
+ INIT(Client) {
+ if (this.m_unwind(this)) return this;
+ make_impure(this);
+ this.classname = "player_joining";
+ static int playerid_last;
+ this.playerid = ++playerid_last;
+ ClientState_attach(this);
+ }
+ DESTRUCTOR(Client) {
+ Client_Remove(this);
+ }
+ CONSTRUCTOR(Client, string name) {
+ CONSTRUCT(Client);
+ this.netname = name;
+ this.netaddress = "local";
+ this.playermodel = "models/player/megaerebus.iqm";
+ }
+ENDCLASS(Client)
+
+CLASS(Observer, Client)
+ INIT(Observer) {
+ this.classname = STR_OBSERVER;
+ }
+ DESTRUCTOR(Observer) { }
+ENDCLASS(Observer)
+
+CLASS(Spectator, Client)
+ INIT(Spectator) {
+ this.classname = STR_SPECTATOR;
+ }
+ DESTRUCTOR(Spectator) { }
+ENDCLASS(Spectator)
+
+CLASS(Player, Client)
+ INIT(Player) {
+ this.classname = STR_PLAYER;
+ }
+ DESTRUCTOR(Player) { }
+ENDCLASS(Player)
+
+METHOD(Client, m_unwind, bool(Client this))
+{
+ TC(Client, this);
+ #define UNWIND(class) MACRO_BEGIN if (this.instanceOf##class) { METHOD_REFERENCE(class, dtorimpl)(this); } MACRO_END
+ switch (this.classname) {
+ case "Observer":
+ UNWIND(Spectator);
+ UNWIND(Player);
+ return true;
+ case "Spectator":
+ UNWIND(Observer);
+ UNWIND(Player);
+ return true;
+ case "Player":
+ UNWIND(Observer);
+ UNWIND(Spectator);
+ return true;
+ }
+ #undef UNWIND
+ return false;
+}
+
float c1, c2, c3, c4;
-void play_countdown(float finished, string samp);
+void play_countdown(float finished, Sound samp);
float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit);
#define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee)
#define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); }
-
-#endif
+#include "cl_impulse.qh"
#include "round_handler.qh"
#include "bot/waypoints.qh"
#include "weapons/tracing.qh"
#include "weapons/weaponsystem.qh"
+#include <common/state.qh>
+
#include "../common/minigames/sv_minigames.qh"
#include "../common/weapons/all.qh"
e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
}
entity e2 = navigation_findnearestwaypoint(this, false);
- navigation_markroutes(e2);
+ navigation_markroutes(this, e2);
int i, m;
-#ifndef CL_IMPULSE_H
-#define CL_IMPULSE_H
+#pragma once
void ImpulseCommands(entity this);
-#endif
#include "teamplay.qh"
#include "weapons/throwing.qh"
#include "command/common.qh"
+#include "../common/state.qh"
#include "../common/anim.qh"
#include "../common/animdecide.qh"
#include "../common/csqcmodel_settings.qh"
#include "../common/minigames/sv_minigames.qh"
+#include "../common/physics/player.qh"
+#include "../common/effects/qc/all.qh"
#include "../common/mutators/mutator/waypoints/waypointsprites.qh"
#include "../common/triggers/include.qh"
void CopyBody_Think()
{SELFPARAM();
- if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
+ if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
{
- self.CopyBody_think();
- if(wasfreed(self))
+ this.CopyBody_think();
+ if(wasfreed(this))
return;
- self.CopyBody_nextthink = self.nextthink;
- self.CopyBody_think = self.think;
- self.think = CopyBody_Think;
+ this.CopyBody_nextthink = this.nextthink;
+ this.CopyBody_think = this.think;
+ this.think = CopyBody_Think;
}
- CSQCMODEL_AUTOUPDATE(self);
- self.nextthink = time;
+ CSQCMODEL_AUTOUPDATE(this);
+ this.nextthink = time;
}
void CopyBody(entity this, float keepvelocity)
{
void player_anim ()
{SELFPARAM();
- int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
- if(IS_DEAD(self)) {
+ int deadbits = (this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+ if(IS_DEAD(this)) {
if (!deadbits) {
// Decide on which death animation to use.
if(random() < 0.5)
deadbits = 0;
}
int animbits = deadbits;
- if(STAT(FROZEN, self))
+ if(STAT(FROZEN, this))
animbits |= ANIMSTATE_FROZEN;
- if(self.movetype == MOVETYPE_FOLLOW)
+ if(this.movetype == MOVETYPE_FOLLOW)
animbits |= ANIMSTATE_FOLLOW;
- if(self.crouch)
+ if(this.crouch)
animbits |= ANIMSTATE_DUCK;
- animdecide_setstate(self, animbits, false);
- animdecide_setimplicitstate(self, IS_ONGROUND(self));
+ animdecide_setstate(this, animbits, false);
+ animdecide_setimplicitstate(this, IS_ONGROUND(this));
}
void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
excess = frag_damage;
Weapon wep = PS(this).m_weapon;
- WITH(entity, self, this, wep.wr_playerdeath(wep));
+ WITHSELF(this, wep.wr_playerdeath(wep));
RemoveGrapplingHook(this);
// reset fields the weapons may use just in case
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- WITH(entity, self, this, it.wr_resetplayer(it));
+ WITHSELF(this, it.wr_resetplayer(it));
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
-#ifndef CL_PLAYER_H
-#define CL_PLAYER_H
+#pragma once
.entity pusher;
.float pushltime;
/** to be used by `prvm_edictset server playernumber muted 1` */
.float muted;
int Say(entity source, float teamsay, entity privatesay, string msgin, float floodcontrol);
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "banning.qc"
+#include "cmd.qc"
+#include "common.qc"
+#include "getreplies.qc"
+#include "radarmap.qc"
+#include "sv_cmd.qc"
+#include "vote.qc"
+#include "all.qh"
#include <common/command/all.qc>
-
-#include "sv_cmd.qc"
-
-#include "banning.qc"
-#include "cmd.qc"
-#include "common.qc"
-#include "getreplies.qc"
-#include "radarmap.qc"
-#include "vote.qc"
-#ifndef SERVER_COMMANDS_ALL_H
-#define SERVER_COMMANDS_ALL_H
+#pragma once
#include <common/command/command.qh>
REGISTRY(SERVER_COMMANDS, BITS(7))
ATTRIB(servercommand_##id, m_description, string, description); \
ENDCLASS(servercommand_##id) \
REGISTER(SERVER_COMMANDS, CMD_SV, id, m_id, NEW(servercommand_##id)); \
- METHOD(servercommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+ METHOD(servercommand_##id, m_invokecmd, void(servercommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(SERVER_COMMANDS_aliases) {
FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_sv"))));
#include "getreplies.qh"
#include "radarmap.qh"
#include "vote.qh"
-
-#endif
+#include "banning.qh"
#include <common/command/command.qh>
#include "banning.qh"
-#ifndef BANNING_H
-#define BANNING_H
+#pragma once
// ====================================
// Declarations for kick/ban commands
void BanCommand_macro_help();
float BanCommand_macro_usage(float argc);
-
-#endif
-#include <common/command/command.qh>
#include "cmd.qh"
+#include <common/command/command.qh>
#include "common.qh"
#include "vote.qh"
#include <common/constants.qh>
#include <common/deathtypes/all.qh>
+#include <common/effects/all.qh>
#include <common/mapinfo.qh>
#include <common/notifications/all.qh>
#include <common/physics/player.qh>
}
else if (teamplay && !autocvar_sv_spectate && !(self.team_forced > 0))
{
- self.classname = STR_OBSERVER; // really?
+ TRANSMUTE(Observer, self); // really?
stuffcmd(self, "menu_showteamselect\n");
}
}
if (self.caplayer) return;
if (nJoinAllowed(self, self))
{
- if (autocvar_g_campaign) campaign_bots_may_start = 1;
- self.classname = STR_PLAYER;
+ if (autocvar_g_campaign) campaign_bots_may_start = true;
+ TRANSMUTE(Player, self);
PlayerScore_Clear(self);
Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && self.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname);
tokenize_console(s);
}
- GetCvars(1);
+ GetCvars(this, 1);
return;
}
if (command != command2) return;
// if we're banned, don't even parse the command
- if (Ban_MaybeEnforceBanOnce(self)) return;
+ if (Ban_MaybeEnforceBanOnce(this)) return;
float argc = tokenize_console(command);
{
if (argc == 1)
{
- sprint(self, "\nClient networked commands:\n");
+ sprint(this, "\nClient networked commands:\n");
ClientCommand_macro_help();
- sprint(self, "\nCommon networked commands:\n");
- CommonCommand_macro_help(self);
+ sprint(this, "\nCommon networked commands:\n");
+ CommonCommand_macro_help(this);
- sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
- sprint(self, "For help about a specific command, type cmd help COMMAND\n");
+ sprint(this, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
+ sprint(this, "For help about a specific command, type cmd help COMMAND\n");
return;
}
- else if (CommonCommand_macro_usage(argc, self)) // Instead of trying to call a command, we're going to see detailed information about it
+ else if (CommonCommand_macro_usage(argc, this)) // Instead of trying to call a command, we're going to see detailed information about it
{
return;
}
{
return; // handled by server/cheats.qc
}
- else if (CommonCommand_macro_command(argc, self, command))
+ else if (CommonCommand_macro_command(argc, this, command))
{
return; // handled by server/command/common.qc
}
}
else
{
- clientcommand(self, command);
+ clientcommand(this, command);
}
}
-#ifndef CMD_H
-#define CMD_H
+#pragma once
// =================================================
// Declarations for server side networked commands
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
void ClientCommand_macro_write_aliases(float fh);
-#endif
+#include "common.qh"
#include <common/command/command.qh>
#include "common.qh"
void CommonCommand_editmob(int request, entity caller, int argc)
{
- SELFPARAM();
switch (request)
{
case CMD_REQUEST_COMMAND:
-#ifndef COMMAND_COMMON_H
-#define COMMAND_COMMON_H
+#pragma once
#include <common/command/command.qh>
REGISTRY(COMMON_COMMANDS, BITS(7))
ATTRIB(commoncommand_##id, m_description, string, description); \
ENDCLASS(commoncommand_##id) \
REGISTER(COMMON_COMMANDS, CMD_SV, id, m_id, NEW(commoncommand_##id)); \
- METHOD(commoncommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+ METHOD(commoncommand_##id, m_invokecmd, void(commoncommand_##id this, int request, entity caller, int arguments, string command))
STATIC_INIT(COMMON_COMMANDS_aliases) {
FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
{
string c = strtolower(argv(0));
FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
- it.m_invokecmd(CMD_REQUEST_COMMAND, caller, argc, command);
+ it.m_invokecmd(it, CMD_REQUEST_COMMAND, caller, argc, command);
return true;
));
return false;
{
string c = strtolower(argv(1));
FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
- it.m_invokecmd(CMD_REQUEST_USAGE, caller, argc, "");
+ it.m_invokecmd(it, CMD_REQUEST_USAGE, caller, argc, "");
return true;
));
return false;
{
FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description)));
}
-
-
-#endif
+#include "getreplies.qh"
#include <common/command/command.qh>
#include "getreplies.qh"
-#ifndef GETREPLIES_H
-#define GETREPLIES_H
+#pragma once
// ======================================================
// Declarations for reply messages, re-worked by Samual
string getmaplist();
string getlsmaps();
string getmonsterlist();
-#endif
+#include "radarmap.qh"
#include <common/command/command.qh>
#include "radarmap.qh"
-#ifndef RADARMAP_H
-#define RADARMAP_H
+#pragma once
// ===========================================
// Declarations for radarmap generation code
// removes the need to bound()
float RadarMap_Make(float argc);
-
-
-#endif
+#include "sv_cmd.qh"
#include "all.qh"
#include "banning.qh"
int n = 0;
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
if (it.caplayer) it.caplayer = 0;
- WITH(entity, self, it, PutObserverInServer());
+ WITHSELF(it, PutObserverInServer());
++n;
));
if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
void GameCommand_anticheat(float request, float argc)
{
- SELFPARAM();
switch (request)
{
case CMD_REQUEST_COMMAND:
if (accepted > 0)
{
- WITH(entity, self, client, anticheat_report());
+ anticheat_report(client);
return;
}
else
if (!IS_SPEC(client) && !IS_OBSERVER(client))
{
if (client.caplayer) client.caplayer = 0;
- WITH(entity, self, client, PutObserverInServer());
+ WITHSELF(client, PutObserverInServer());
successful = strcat(successful, (successful ? ", " : ""), client.netname);
}
return;
}
- WITH(entity, self, client, playerdemo_open_read(argv(next_token)));
+ WITHSELF(client, playerdemo_open_read(argv(next_token)));
return;
}
return;
}
- WITH(entity, self, client, playerdemo_open_write(argv(next_token)));
+ WITHSELF(client, playerdemo_open_write(argv(next_token)));
return;
}
{
string c = strtolower(argv(0));
FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
- it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+ it.m_invokecmd(it, CMD_REQUEST_COMMAND, NULL, argc, command);
return true;
));
return false;
{
string c = strtolower(argv(1));
FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
- it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+ it.m_invokecmd(it, CMD_REQUEST_USAGE, NULL, argc, "");
return true;
));
return false;
-#ifndef SV_CMD_H
-#define SV_CMD_H
+#pragma once
// =================================================
// Declarations for server side game commands
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
void GameCommand_macro_write_aliases(float fh);
-#endif
+#include "vote.qh"
#include <common/command/command.qh>
#include "vote.qh"
MUTATOR_CALLHOOK(reset_map_global);
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
if (it.reset)
{
- WITH(entity, self, it, it.reset(it));
+ WITHSELF(it, it.reset(it));
continue;
}
if (it.team_saved) it.team = it.team_saved;
if (it.flags & FL_PROJECTILE) remove(it); // remove any projectiles left
- ));
+ });
// Waypoints and assault start come LAST
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
- if (it.reset2) WITH(entity, self, it, it.reset2());
- ));
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
+ if (it.reset2) WITHSELF(it, it.reset2());
+ });
- FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITH(entity, self, it, Unfreeze(it))));
+ FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITHSELF(it, Unfreeze(it))));
// Moving the player reset code here since the player-reset depends
// on spawnpoint entities which have to be reset first --blub
-#ifndef VOTE_H
-#define VOTE_H
+#pragma once
// ================================================
// Declarations for the vote system/vote commands
void ReadyCount();
void ReadyRestart_force();
void VoteCount(float first_count);
-#endif
-#ifndef SERVER_CONSTANTS_H
-#define SERVER_CONSTANTS_H
+#pragma once
const int FL_WEAPON = BIT(13);
const int FL_POWERUP = BIT(14);
const int NUM_PLAYERSKINS_TEAMPLAY = 3;
const int ASSAULT_VALUE_INACTIVE = 1000;
-
-#endif
-#ifndef SERVER_DEFS_H
-#define SERVER_DEFS_H
+#pragma once
-#include "../common/weapons/all.qh"
-#include "../common/stats.qh"
+float warmup_limit;
+#include <common/weapons/all.qh>
+#include <common/stats.qh>
#define INDEPENDENT_ATTACK_FINISHED 1
// Globals
float g_footsteps, g_grappling_hook, g_instagib;
-float g_warmup_limit;
float g_warmup_allguns;
float g_warmup_allow_timeout;
float warmup_stage;
.entity flagcarried;
.int playerid;
-float playerid_last;
.float noalign; // if set to 1, the item or spawnpoint won't be dropped to the floor
.vector death_origin;
WepSet weaponsInMap;
#define weapons _STAT(WEAPONS)
-#define weaponsinmap _STAT(WEAPONSINMAP)
.float respawn_countdown; // next number to count
float game_starttime; //point in time when the countdown to game start is over
float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime = _STAT(GAMESTARTTIME);
-.float stat_round_starttime = _STAT(ROUNDSTARTTIME);
void W_Porto_Remove (entity p);
.string message2;
-.bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
-
// reset to 0 on weapon switch
// may be useful to all weapons
.float bulletcounter;
.float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
-.float stat_leadlimit = _STAT(LEADLIMIT);
-
bool radar_showennemies;
#ifdef PROFILING
string deathmessage;
-.float just_joined;
+.bool just_joined;
.float cvar_cl_weaponimpulsemode;
.float selectweapon; // last selected weapon of the player
void PlayerUseKey();
-typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
+USING(spawn_evalfunc_t, vector(entity player, entity spot, vector current));
.spawn_evalfunc_t spawn_evalfunc;
string modname;
.float init_for_player_needed;
.void(entity) init_for_player;
-
-#endif
#include "mutators/all.qh"
#include "scores.qh"
#include "spawnpoints.qh"
+#include "../common/state.qh"
+#include "../common/physics/player.qh"
#include "../common/t_items.qh"
#include "../common/vehicles/all.qh"
#include "../common/items/all.qc"
targ.iceblock = ice;
targ.revival_time = 0;
- WITH(entity, self, ice, Ice_Think());
+ WITHSELF(ice, Ice_Think());
RemoveGrapplingHook(targ);
void Unfreeze (entity targ)
{
+ SELFPARAM();
if(!STAT(FROZEN, targ))
return;
-#ifndef G_DAMAGE_H
-#define G_DAMAGE_H
+#pragma once
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
- #include "../lib/warpzone/common.qh"
- #include "../common/constants.qh"
- #include "../common/teams.qh"
- #include "../common/util.qh"
- #include "../common/weapons/all.qh"
+ #include <lib/warpzone/common.qh>
+ #include <common/constants.qh>
+ #include <common/teams.qh>
+ #include <common/util.qh>
+ #include <common/weapons/all.qh>
#include "weapons/accuracy.qh"
#include "weapons/csqcprojectile.qh"
#include "weapons/selection.qh"
- #include "../common/t_items.qh"
+ #include <common/t_items.qh>
#include "autocvars.qh"
#include "constants.qh"
#include "defs.qh"
- #include "../common/notifications/all.qh"
- #include "../common/deathtypes/all.qh"
+ #include <common/notifications/all.qh>
+ #include <common/deathtypes/all.qh>
#include "mutators/all.qh"
- #include "../common/turrets/sv_turrets.qh"
- #include "../common/vehicles/all.qh"
- #include "../lib/csqcmodel/sv_model.qh"
- #include "../common/playerstats.qh"
+ #include <common/turrets/sv_turrets.qh>
+ #include <common/vehicles/all.qh>
+ #include <lib/csqcmodel/sv_model.qh>
+ #include <common/playerstats.qh>
#include "g_hook.qh"
#include "scores.qh"
#include "spawnpoints.qh"
void UpdateFrags(entity player, float f);
// NOTE: f=0 means still count as a (positive) kill, but count no frags for it
-void W_SwitchWeapon_Force(entity e, Weapon w);
+void W_SwitchWeapon_Force(Player this, Weapon w);
entity GiveFrags_randomweapons;
void GiveFrags (entity attacker, entity targ, float f, int deathtype);
void Fire_ApplyEffect(entity e);
void fireburner_think();
-#endif
#include "cl_player.qh"
#include "command/common.qh"
#include "round_handler.qh"
+#include "../common/state.qh"
+#include "../common/physics/player.qh"
#include "../common/vehicles/all.qh"
#include "../common/constants.qh"
#include "../common/util.qh"
-#ifndef HOOK_H
-#define HOOK_H
+#pragma once
// Wazat's grappling hook
.entity hook;
void GrappleHookInit();
vector hook_shotorigin[4];
-#endif
+#include "g_lights.qh"
void train_next();
*/
void dynlight_think()
{
+ SELFPARAM();
if(!self.owner)
remove(self);
self.nextthink = time + 0.1;
}
-void dynlight_find_aiment()
+void dynlight_find_aiment(entity this)
{
entity targ;
if (!self.target)
self.think = dynlight_think;
self.nextthink = time + 0.1;
}
-void dynlight_find_path()
+void dynlight_find_path(entity this)
{
entity targ;
if (!self.target)
self.think = train_next;
self.nextthink = time + 0.1;
}
-void dynlight_find_target()
+void dynlight_find_target(entity this)
{
entity targ;
if (!self.target)
}
void dynlight_use()
{
+ SELFPARAM();
if (self.light_lev == 0)
self.light_lev = self.lefty;
else
--- /dev/null
+#pragma once
+#include "g_models.qh"
#include "g_subs.qh"
#include "../common/triggers/subs.qh"
g_clientmodel_setcolormaptoactivator();
}
-void g_model_dropbyspawnflags()
-{SELFPARAM();
+void g_model_dropbyspawnflags(entity this)
+{
if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN
{
traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
}
}
-void g_clientmodel_dropbyspawnflags()
-{SELFPARAM();
+void g_clientmodel_dropbyspawnflags(entity this)
+{
vector o0;
o0 = self.origin;
- g_model_dropbyspawnflags();
+ g_model_dropbyspawnflags(self);
if(self.origin != o0)
self.SendFlags |= 2;
}
--- /dev/null
+#pragma once
#include "antilag.qh"
#include "command/common.qh"
+#include "../common/state.qh"
#include "../lib/warpzone/common.qh"
#include "../common/triggers/subs.qh"
if (lag)
{
// take players back into the past
- FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_takeback(it, time - lag)));
- FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_takeback(it, CS(it), time - lag));
+ FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
if(it != forent)
- antilag_takeback(it, time - lag);
- ));
+ antilag_takeback(it, it, time - lag);
+ });
}
// do the trace
// restore players to current positions
if (lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != forent, LAMBDA(antilag_restore(it)));
- FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
- if(it != forent)
- antilag_restore(it);
- ));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != forent, antilag_restore(it, CS(it)));
+ FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+ if (it != forent)
+ antilag_restore(it, it);
+ });
}
// restore shooter solid type
{
int d = autocvar_loddebug;
if(d == 1)
- self.modelindex = self.lodmodelindex0;
- else if(d == 2 || !self.lodmodelindex2)
- self.modelindex = self.lodmodelindex1;
+ this.modelindex = this.lodmodelindex0;
+ else if(d == 2 || !this.lodmodelindex2)
+ this.modelindex = this.lodmodelindex1;
else // if(d == 3)
- self.modelindex = self.lodmodelindex2;
+ this.modelindex = this.lodmodelindex2;
return true;
}
// TODO csqc network this so it only gets sent once
- vector near_point = NearestPointOnBox(self, other.origin);
- if(vdist(near_point - other.origin, <, self.loddistance1))
- self.modelindex = self.lodmodelindex0;
- else if(!self.lodmodelindex2 || vdist(near_point - other.origin, <, self.loddistance2))
- self.modelindex = self.lodmodelindex1;
+ vector near_point = NearestPointOnBox(this, other.origin);
+ if(vdist(near_point - other.origin, <, this.loddistance1))
+ this.modelindex = this.lodmodelindex0;
+ else if(!this.lodmodelindex2 || vdist(near_point - other.origin, <, this.loddistance2))
+ this.modelindex = this.lodmodelindex1;
else
- self.modelindex = self.lodmodelindex2;
+ this.modelindex = this.lodmodelindex2;
return true;
}
void LOD_uncustomize()
{SELFPARAM();
- self.modelindex = self.lodmodelindex0;
+ this.modelindex = this.lodmodelindex0;
}
-void LODmodel_attach()
-{SELFPARAM();
+void LODmodel_attach(entity this)
+{
entity e;
- if(!self.loddistance1)
- self.loddistance1 = 1000;
- if(!self.loddistance2)
- self.loddistance2 = 2000;
- self.lodmodelindex0 = self.modelindex;
+ if(!this.loddistance1)
+ this.loddistance1 = 1000;
+ if(!this.loddistance2)
+ this.loddistance2 = 2000;
+ this.lodmodelindex0 = this.modelindex;
- if(self.lodtarget1 != "")
+ if(this.lodtarget1 != "")
{
- e = find(world, targetname, self.lodtarget1);
+ e = find(world, targetname, this.lodtarget1);
if(e)
{
- self.lodmodel1 = e.model;
+ this.lodmodel1 = e.model;
remove(e);
}
}
- if(self.lodtarget2 != "")
+ if(this.lodtarget2 != "")
{
- e = find(world, targetname, self.lodtarget2);
+ e = find(world, targetname, this.lodtarget2);
if(e)
{
- self.lodmodel2 = e.model;
+ this.lodmodel2 = e.model;
remove(e);
}
}
if(autocvar_loddebug < 0)
{
- self.lodmodel1 = self.lodmodel2 = ""; // don't even initialize
+ this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
}
- if(self.lodmodel1 != "")
+ if(this.lodmodel1 != "")
{
vector mi, ma;
- mi = self.mins;
- ma = self.maxs;
+ mi = this.mins;
+ ma = this.maxs;
- precache_model(self.lodmodel1);
- _setmodel(self, self.lodmodel1);
- self.lodmodelindex1 = self.modelindex;
+ precache_model(this.lodmodel1);
+ _setmodel(this, this.lodmodel1);
+ this.lodmodelindex1 = this.modelindex;
- if(self.lodmodel2 != "")
+ if(this.lodmodel2 != "")
{
- precache_model(self.lodmodel2);
- _setmodel(self, self.lodmodel2);
- self.lodmodelindex2 = self.modelindex;
+ precache_model(this.lodmodel2);
+ _setmodel(this, this.lodmodel2);
+ this.lodmodelindex2 = this.modelindex;
}
- self.modelindex = self.lodmodelindex0;
- setsize(self, mi, ma);
+ this.modelindex = this.lodmodelindex0;
+ setsize(this, mi, ma);
}
- if(self.lodmodelindex1)
- if (!self.SendEntity)
- SetCustomizer(self, LOD_customize, LOD_uncustomize);
+ if(this.lodmodelindex1)
+ if (!this.SendEntity)
+ SetCustomizer(this, LOD_customize, LOD_uncustomize);
}
void ApplyMinMaxScaleAngles(entity e)
-#ifndef G_SUBS_H
-#define G_SUBS_H
+#pragma once
void SUB_NullThink();
void LOD_uncustomize();
-void LODmodel_attach();
+void LODmodel_attach(entity this);
void ApplyMinMaxScaleAngles(entity e);
void InitSolidBSPTrigger();
float InitMovingBrushTrigger();
-#endif
#include "../common/util.qh"
#include "../common/items/all.qh"
#include "../common/weapons/all.qh"
+#include "../common/state.qh"
const float LATENCY_THINKRATE = 10;
.float latency_sum;
delta = 3 / maxclients;
if(delta < sys_frametime)
delta = 0;
- self.nextthink = time + delta;
+ this.nextthink = time + delta;
- e = edict_num(self.cnt + 1);
+ e = edict_num(this.cnt + 1);
if(IS_REAL_CLIENT(e))
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
- WriteByte(MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_BROADCAST, this.cnt);
WriteShort(MSG_BROADCAST, max(1, e.ping));
WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
else
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
- WriteByte(MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_BROADCAST, this.cnt);
WriteShort(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
}
- self.cnt = (self.cnt + 1) % maxclients;
+ this.cnt = (this.cnt + 1) % maxclients;
}
void PingPLReport_Spawn()
{
bool RandomSeed_Send(entity this, entity to, int sf)
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
- WriteShort(MSG_ENTITY, self.cnt);
+ WriteShort(MSG_ENTITY, this.cnt);
return true;
}
void RandomSeed_Think()
{SELFPARAM();
- self.cnt = bound(0, floor(random() * 65536), 65535);
- self.nextthink = time + 5;
+ this.cnt = bound(0, floor(random() * 65536), 65535);
+ this.nextthink = time + 5;
- self.SendFlags |= 1;
+ this.SendFlags |= 1;
}
void RandomSeed_Spawn()
{SELFPARAM();
randomseed.think = RandomSeed_Think;
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
- WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
+ WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
}
spawnfunc(__init_dedicated_server)
*/
void NextLevel()
{
+ SELFPARAM();
gameover = true;
intermission_running = 1;
bprint(it.netname, " ^7wins.\n");
));
- entity oldself = self;
- target_music_kill();
- self = oldself;
+ WITHSELF(NULL, target_music_kill());
if(autocvar_g_campaign)
CampaignPreIntermission();
if (gameover) // someone else quit the game already
return;
- if(!IS_DEAD(self))
- self.play_time += frametime;
+ if(!IS_DEAD(this))
+ this.play_time += frametime;
// fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
// (div0: and that in CheckRules_World please)
void EndFrame()
-{SELFPARAM();
+{
anticheat_endframe();
- float altime;
- FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_REAL_CLIENT(it), {
entity e = IS_SPEC(it) ? it.enemy : it;
- if(e.typehitsound)
+ if (e.typehitsound) {
it.typehit_time = time;
- else if(e.damage_dealt)
- {
+ } else if (e.damage_dealt) {
it.hit_time = time;
it.damage_dealt_total += ceil(e.damage_dealt);
}
- ));
- altime = time + frametime * (1 + autocvar_g_antilag_nudge);
+ });
// add 1 frametime because after this, engine SV_Physics
// increases time by a frametime and then networks the frame
// add another frametime because client shows everything with
// 1 frame of lag (cl_nolerp 0). The last +1 however should not be
// needed!
- FOREACH_CLIENT(true, LAMBDA(
+ float altime = time + frametime * (1 + autocvar_g_antilag_nudge);
+ FOREACH_CLIENT(true, {
it.typehitsound = false;
it.damage_dealt = 0;
- setself(it);
- antilag_record(it, altime);
- ));
- FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
- setself(it);
- antilag_record(it, altime);
- ));
- FOREACH_CLIENT(PS(it), LAMBDA(
+ antilag_record(it, CS(it), altime);
+ });
+ FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+ antilag_record(it, it, altime);
+ });
+ FOREACH_CLIENT(PS(it), {
PlayerState s = PS(it);
s.ps_push(s, it);
- ));
+ });
}
-#ifndef G_WORLD_H
-#define G_WORLD_H
+#pragma once
float checkrules_equality;
float checkrules_suddendeathwarning;
float checkrules_suddendeathend;
float checkrules_overtimesadded; //how many overtimes have been already added
-const float WINNING_NO = 0; // no winner, but time limits may terminate the game
-const float WINNING_YES = 1; // winner found
-const float WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
-const float WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
+const int WINNING_NO = 0; // no winner, but time limits may terminate the game
+const int WINNING_YES = 1; // winner found
+const int WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
+const int WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
+float WinningCondition_Scores(float limit, float leadlimit);
+void SetWinners(.float field, float value);
void CheckRules_Player();
void IntermissionThink();
void GotoNextMap(float reinit);
void Map_Goto(float reinit);
float DoNextMapOverride(float reinit);
void CheckRules_World();
-
-#endif
LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ");
LOG_INFO(reason, "\n");
-:skip
+LABEL(skip)
}
}
goto killme;
return;
-:killme
+LABEL(killme)
remove(self);
}
ban_ip4 = strcat1(s); // 32
return true;
-:ipv6
+LABEL(ipv6)
i1 = strstrofs(s, ":", 0);
if(i1 < 0)
return false;
-#ifndef IPBAN_H
-#define IPBAN_H
+#pragma once
void Ban_SaveBans();
void Ban_LoadBans();
float BanCommand(string command);
void OnlineBanList_URI_Get_Callback(float id, float status, string data);
-#endif
-#ifndef ITEM_KEY
-#define ITEM_KEY
+#pragma once
/**
* Returns the bit ID of a key
*/
string item_keys_keylist(float keylist);
#endif
-
-#endif
}
if(i >= mapvote_screenshot_dirs_count)
i = 0; // FIXME maybe network this error case, as that means there is no mapshot on the server?
- for(o = strstr(pakfile, "/", 0)+1; o > 0; o = strstr(pakfile, "/", 0)+1)
+ for(o = strstrofs(pakfile, "/", 0)+1; o > 0; o = strstrofs(pakfile, "/", 0)+1)
pakfile = substring(pakfile, o, -1);
mapvote_maps_screenshot_dir[mapvote_count] = i;
-#ifndef MAPVOTING_H
-#define MAPVOTING_H
+#pragma once
// definitions for functions used outside mapvoting.qc
void MapVote_Start();
float gametypevote;
string getmapname_stored;
float mapvote_initialized;
-#endif
#include "../common/vehicles/sv_vehicles.qh"
#include "../common/vehicles/vehicle.qh"
#include "../common/items/all.qc"
+#include "../common/state.qh"
+#include "../common/effects/qc/globalsound.qh"
#include "../lib/csqcmodel/sv_model.qh"
#include "../lib/warpzone/anglestransform.qh"
#include "../lib/warpzone/server.qh"
break; // too many replacements
n = n - 1;
- p1 = strstr(msg, "%", p); // NOTE: this destroys msg as it's a tempstring!
- p2 = strstr(msg, "\\", p); // NOTE: this destroys msg as it's a tempstring!
+ p1 = strstrofs(msg, "%", p); // NOTE: this destroys msg as it's a tempstring!
+ p2 = strstrofs(msg, "\\", p); // NOTE: this destroys msg as it's a tempstring!
if (p1 < 0)
p1 = p2;
/**
* @param f -1: cleanup, 0: request, 1: receive
*/
-void GetCvars(int f)
-{SELFPARAM();
+void GetCvars(entity this, int f)
+{
string s = string_null;
if (f > 0)
}
void precache()
-{SELFPARAM();
+{
// gamemode related things
// Precache all player models if desired
builtin_remove(e);
}
-void InitializeEntity(entity e, void() func, float order)
+void InitializeEntity(entity e, void(entity this) func, float order)
{
entity prev, cur;
}
}
void InitializeEntitiesRun()
-{SELFPARAM();
+{
entity startoflist = initialize_entity_first;
initialize_entity_first = NULL;
remove = remove_except_protected;
e.initialize_entity_order = 0;
entity next = e.initialize_entity_next;
e.initialize_entity_next = NULL;
- var void() func = e.initialize_entity;
+ var void(entity this) func = e.initialize_entity;
e.initialize_entity = func_null;
if (e.classname == "initialize_entity")
{
//dprint("Delayed initialization: ", e.classname, "\n");
if (func)
{
- WITH(entity, self, e, func());
+ WITHSELF(e, func(e));
}
else
{
}
// deferred dropping
-void DropToFloor_Handler()
-{SELFPARAM();
+void DropToFloor_Handler(entity this)
+{
builtin_droptofloor();
self.dropped_origin = self.origin;
}
return 0;
}
-float isPushable(entity e)
+.bool pushable;
+bool isPushable(entity e)
{
if(e.pushable)
return true;
-#ifndef MISCFUNCTIONS_H
-#define MISCFUNCTIONS_H
+#pragma once
-#include "../common/t_items.qh"
+#include <common/t_items.qh>
#include "mutators/events.qh"
-#include "../common/constants.qh"
-#include "../common/mapinfo.qh"
-#include "../common/turrets/all.qh"
+#include <common/constants.qh>
+#include <common/mapinfo.qh>
+#include <common/turrets/all.qh>
#ifdef RELEASE
#define cvar_string_normal builtin_cvar_string
void GameLogClose();
-void GetCvars(float f);
+void GetCvars(entity this, float f);
string GetMapname();
float logfile_open;
float logfile;
-#define strstr strstrofs
/*
// NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
// IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
// STRINGS AND TAKE QUITE LONG. haystack and needle MUST
// BE CONSTANT OR strzoneD!
-float strstr(string haystack, string needle, float offset)
+float strstrofs(string haystack, string needle, float offset)
{
float len, endpos;
string found;
sv_taunt = cvar("sv_taunt");
warmup_stage = cvar("g_warmup");
- g_warmup_limit = cvar("g_warmup_limit");
+ warmup_limit = cvar("g_warmup_limit");
+ if(warmup_limit == 0)
+ warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
g_warmup_allguns = cvar("g_warmup_allguns");
g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
const float INITPRIO_LINKDOORS = 91;
const float INITPRIO_LAST = 99;
-.void() initialize_entity;
+.void(entity this) initialize_entity;
.float initialize_entity_order;
.entity initialize_entity_next;
entity initialize_entity_first;
float sound_allowed(float dest, entity e);
-void InitializeEntity(entity e, void() func, float order);
+void InitializeEntity(entity e, void(entity this) func, float order);
void SetCustomizer(entity e, float() customizer, void() uncustomizer);
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "all.qh"
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
+#pragma once
+
#include "mutator.qh"
#include "gamemode.qh"
-#ifndef SERVER_MUTATORS_H
-#define SERVER_MUTATORS_H
-
#include "all.inc"
-
-#endif
-#ifndef SERVER_MUTATORS_EVENTS_H
-#define SERVER_MUTATORS_EVENTS_H
+#pragma once
#include <common/mutators/base.qh>
/** called when a bot checks a target to attack */
#define EV_BotShouldAttack(i, o) \
+ /**/ i(entity, __self) \
/**/ i(entity, checkentity) \
/**/
entity checkentity;
* called when a vehicle initializes
* return true to remove the vehicle
*/
-MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
+#define EV_VehicleSpawn(i, o) \
+ /**/ i(entity, __self) \
+ /**/
+MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
/**
* called when a player enters a vehicle
float uricb_status;
string uricb_data;
MUTATOR_HOOKABLE(URI_GetCallback, EV_URI_GetCallback);
-#endif
-#ifndef GAMEMODE_H
-#define GAMEMODE_H
+#pragma once
-#include "../cl_client.qh"
-#include "../cl_player.qh"
-#include "../cl_impulse.qh"
-#include "../cheats.qh"
-#include "../g_damage.qh"
-#include "../round_handler.qh"
-#include "../scores.qh"
-#include "../scores_rules.qh"
-#include "../teamplay.qh"
+#include <server/cl_client.qh>
+#include <server/cl_player.qh>
+#include <server/cl_impulse.qh>
+#include <server/cheats.qh>
+#include <server/g_damage.qh>
+#include <server/g_world.qh>
+#include <server/round_handler.qh>
+#include <server/scores.qh>
+#include <server/scores_rules.qh>
+#include <server/teamplay.qh>
-#include "../bot/bot.qh"
-#include "../bot/navigation.qh"
-#include "../bot/waypoints.qh"
-#include "../bot/havocbot/roles.qh"
+#include <server/bot/bot.qh>
+#include <server/bot/navigation.qh>
+#include <server/bot/waypoints.qh>
+#include <server/bot/havocbot/roles.qh>
-#include "../bot/havocbot/havocbot.qh"
+#include <server/bot/havocbot/havocbot.qh>
-#include "../command/vote.qh"
+#include <server/command/vote.qh>
#include <common/monsters/all.qh>
-#include "../command/common.qh"
+#include <server/command/common.qh>
-#include "../weapons/tracing.qh"
-#include "../weapons/weaponsystem.qh"
+#include <server/weapons/tracing.qh>
+#include <server/weapons/weaponsystem.qh>
+#include <common/physics/player.qh>
+#include <common/effects/qc/all.qh>
#include <common/deathtypes/all.qh>
#include <common/notifications/all.qh>
#include <common/triggers/teleporters.qh>
.float bluealive_stat = _STAT(BLUEALIVE);
.float yellowalive_stat = _STAT(YELLOWALIVE);
.float pinkalive_stat = _STAT(PINKALIVE);
-
-#endif
-#ifndef MUTATOR_H
-#define MUTATOR_H
+#pragma once
#include <common/mutators/base.qh>
-#include "../cl_client.qh"
-#include "../cl_player.qh"
-#include "../cl_impulse.qh"
-#include "../cheats.qh"
-#include "../g_damage.qh"
-#include "../round_handler.qh"
-#include "../scores.qh"
-#include "../scores_rules.qh"
+#include <server/cl_client.qh>
+#include <server/cl_player.qh>
+#include <server/cl_impulse.qh>
+#include <server/cheats.qh>
+#include <server/g_damage.qh>
+#include <server/round_handler.qh>
+#include <server/scores.qh>
+#include <server/scores_rules.qh>
-#include "../bot/bot.qh"
-#include "../bot/navigation.qh"
-#include "../bot/waypoints.qh"
+#include <server/bot/bot.qh>
+#include <server/bot/navigation.qh>
+#include <server/bot/waypoints.qh>
-#include "../bot/havocbot/havocbot.qh"
-#include "../bot/havocbot/roles.qh"
+#include <server/bot/havocbot/havocbot.qh>
+#include <server/bot/havocbot/roles.qh>
-#include "../command/vote.qh"
-#include "../command/common.qh"
+#include <server/command/vote.qh>
+#include <server/command/common.qh>
-#include "../weapons/common.qh"
-#include "../weapons/tracing.qh"
-#include "../weapons/throwing.qh"
-#include "../weapons/weaponsystem.qh"
+#include <server/weapons/common.qh>
+#include <server/weapons/tracing.qh>
+#include <server/weapons/throwing.qh>
+#include <server/weapons/weaponsystem.qh>
#include <common/deathtypes/all.qh>
#include <common/notifications/all.qh>
#include <lib/warpzone/anglestransform.qh>
#include <lib/warpzone/server.qh>
#include <lib/warpzone/util_server.qh>
-
-#endif
--- /dev/null
+// generated file; do not modify
+#include "gamemode_assault.qc"
+#include "gamemode_ca.qc"
+#include "gamemode_ctf.qc"
+#include "gamemode_cts.qc"
+#include "gamemode_deathmatch.qc"
+#include "gamemode_domination.qc"
+#include "gamemode_freezetag.qc"
+#include "gamemode_invasion.qc"
+#include "gamemode_keepaway.qc"
+#include "gamemode_keyhunt.qc"
+#include "gamemode_lms.qc"
+#include "gamemode_race.qc"
+#include "gamemode_tdm.qc"
+#include "gamemode_assault.qh"
#ifndef GAMEMODE_ASSAULT_H
#define GAMEMODE_ASSAULT_H
void assault_ScoreRules();
+void ActivateTeamplay();
REGISTER_MUTATOR(as, false)
{
.int havocbot_role_flags;
.float havocbot_attack_time;
-.void() havocbot_role;
-.void() havocbot_previous_role;
+.void(entity this) havocbot_role;
+.void(entity this) havocbot_previous_role;
-void() havocbot_role_ast_defense;
-void() havocbot_role_ast_offense;
+void(entity this) havocbot_role_ast_defense;
+void(entity this) havocbot_role_ast_offense;
.entity havocbot_ast_target;
void(entity bot) havocbot_ast_reset_role;
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_items;
-void(float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
+void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
// scoreboard stuff
const float ST_ASSAULT_OBJECTIVES = 1;
{
if (e.classname == "target_objective_decrease")
{
- WITH(entity, self, e, target_objective_decrease_activate());
+ WITHSELF(e, target_objective_decrease_activate());
}
}
}
}
-void assault_setenemytoobjective()
-{SELFPARAM();
+void assault_setenemytoobjective(entity this)
+{
entity objective;
for(objective = world; (objective = find(objective, targetname, self.target)); )
{
}
}
-void target_objective_decrease_findtarget()
+void target_objective_decrease_findtarget(entity this)
{
- assault_setenemytoobjective();
+ assault_setenemytoobjective(this);
}
void target_assault_roundend_reset(entity this)
self.winning = 1; // round has been won by attackers
}
-void assault_roundstart_use()
-{SELFPARAM();
+void assault_roundstart_use(entity this)
+{
activator = self;
SUB_UseTargets();
it.team = NUM_TEAM_1;
// Dubbles as teamchange
- WITH(entity, self, it, turret_respawn());
+ WITHSELF(it, turret_respawn());
));
}
+void assault_roundstart_use_self()
+{
+ SELFPARAM();
+ assault_roundstart_use(this);
+}
void assault_wall_think()
{SELFPARAM();
//bprint("ASSAULT: new round\n");
// Eject players from vehicles
- FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, LAMBDA(WITH(entity, self, it, vehicles_exit(VHEF_RELEASE))));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE)));
FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
setself(it);
// they win. Otherwise the defending team wins once the timelimit passes.
int WinningCondition_Assault()
{
+ SELFPARAM();
WinningConditionHelper(); // set worldstatus
int status = WINNING_NO;
}
else
{
- WITH(entity, self, ent, assault_new_round());
+ WITHSELF(ent, assault_new_round());
}
}
}
assault_attacker_team = NUM_TEAM_1;
self.classname = "target_assault_roundstart";
- self.use = assault_roundstart_use;
- self.reset2 = assault_roundstart_use;
+ self.use = assault_roundstart_use_self;
+ self.reset2 = assault_roundstart_use_self;
InitializeEntity(self, assault_roundstart_use, INITPRIO_FINDTARGET);
}
// legacy bot code
-void havocbot_goalrating_ast_targets(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ast_targets(entity this, float ratingscale)
+{
entity ad, best, wp, tod;
float radius, found, bestvalue;
vector p;
// te_lightning2(world, '0 0 0', best.origin);
// te_knightspike(best.origin);
- navigation_routerating(best, ratingscale, 4000);
+ navigation_routerating(this, best, ratingscale, 4000);
best.cnt += 1;
- self.havocbot_attack_time = 0;
+ this.havocbot_attack_time = 0;
- if(checkpvs(self.view_ofs,ad))
- if(checkpvs(self.view_ofs,best))
+ if(checkpvs(this.view_ofs,ad))
+ if(checkpvs(this.view_ofs,best))
{
// dprint("increasing attack time for this target\n");
- self.havocbot_attack_time = time + 2;
+ this.havocbot_attack_time = time + 2;
}
}
}
}
-void havocbot_role_ast_offense()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ast_offense(entity this)
+{
+ if(IS_DEAD(this))
{
- self.havocbot_attack_time = 0;
- havocbot_ast_reset_role(self);
+ this.havocbot_attack_time = 0;
+ havocbot_ast_reset_role(this);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 120;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 120;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ast_reset_role(self);
+ havocbot_ast_reset_role(this);
return;
}
- if(self.havocbot_attack_time>time)
+ if(this.havocbot_attack_time>time)
return;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- navigation_goalrating_start();
- havocbot_goalrating_enemyplayers(20000, self.origin, 650);
- havocbot_goalrating_ast_targets(20000);
- havocbot_goalrating_items(15000, self.origin, 10000);
- navigation_goalrating_end();
+ navigation_goalrating_start(this);
+ havocbot_goalrating_enemyplayers(this, 20000, this.origin, 650);
+ havocbot_goalrating_ast_targets(this, 20000);
+ havocbot_goalrating_items(this, 15000, this.origin, 10000);
+ navigation_goalrating_end(this);
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
}
}
-void havocbot_role_ast_defense()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ast_defense(entity this)
+{
+ if(IS_DEAD(this))
{
- self.havocbot_attack_time = 0;
- havocbot_ast_reset_role(self);
+ this.havocbot_attack_time = 0;
+ havocbot_ast_reset_role(this);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 120;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 120;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ast_reset_role(self);
+ havocbot_ast_reset_role(this);
return;
}
- if(self.havocbot_attack_time>time)
+ if(this.havocbot_attack_time>time)
return;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- navigation_goalrating_start();
- havocbot_goalrating_enemyplayers(20000, self.origin, 3000);
- havocbot_goalrating_ast_targets(20000);
- havocbot_goalrating_items(15000, self.origin, 10000);
- navigation_goalrating_end();
+ navigation_goalrating_start(this);
+ havocbot_goalrating_enemyplayers(this, 20000, this.origin, 3000);
+ havocbot_goalrating_ast_targets(this, 20000);
+ havocbot_goalrating_items(this, 15000, this.origin, 10000);
+ navigation_goalrating_end(this);
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
}
}
-void havocbot_role_ast_setrole(entity bot, float role)
+void havocbot_role_ast_setrole(entity this, float role)
{
switch(role)
{
case HAVOCBOT_AST_ROLE_DEFENSE:
- bot.havocbot_role = havocbot_role_ast_defense;
- bot.havocbot_role_flags = HAVOCBOT_AST_ROLE_DEFENSE;
- bot.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ast_defense;
+ this.havocbot_role_flags = HAVOCBOT_AST_ROLE_DEFENSE;
+ this.havocbot_role_timeout = 0;
break;
case HAVOCBOT_AST_ROLE_OFFENSE:
- bot.havocbot_role = havocbot_role_ast_offense;
- bot.havocbot_role_flags = HAVOCBOT_AST_ROLE_OFFENSE;
- bot.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ast_offense;
+ this.havocbot_role_flags = HAVOCBOT_AST_ROLE_OFFENSE;
+ this.havocbot_role_timeout = 0;
break;
}
}
-void havocbot_ast_reset_role(entity bot)
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_ast_reset_role(entity this)
+{
+ if(IS_DEAD(this))
return;
- if(bot.team == assault_attacker_team)
- havocbot_role_ast_setrole(bot, HAVOCBOT_AST_ROLE_OFFENSE);
+ if(this.team == assault_attacker_team)
+ havocbot_role_ast_setrole(this, HAVOCBOT_AST_ROLE_OFFENSE);
else
- havocbot_role_ast_setrole(bot, HAVOCBOT_AST_ROLE_DEFENSE);
+ havocbot_role_ast_setrole(this, HAVOCBOT_AST_ROLE_DEFENSE);
}
// mutator hooks
MUTATOR_HOOKFUNCTION(as, OnEntityPreSpawn)
{
+ SELFPARAM();
switch(self.classname)
{
case "info_player_team1":
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_ca.qh"
#ifndef GAMEMODE_CA_H
#define GAMEMODE_CA_H
void CA_RoundStart();
bool ca_isEliminated(entity e);
+void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
+
REGISTER_MUTATOR(ca, false)
{
MUTATOR_ONADD
return -1; // no player left
}
+void nades_Clear(entity player);
+
#define CA_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0))
#define CA_ALIVE_TEAMS_OK() (CA_ALIVE_TEAMS() == ca_teams)
float CA_CheckWinner()
SELFPARAM();
if (!allowed_to_spawn && IS_PLAYER(this)) // this is true even when player is trying to join
{
- this.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
if (this.jointime != time && !this.caplayer) // not when connecting
{
this.caplayer = 0.5;
MUTATOR_HOOKFUNCTION(ca, reset_map_players)
{
+ SELFPARAM();
FOREACH_CLIENT(true, {
it.killcount = 0;
if (!it.caplayer && IS_BOT_CLIENT(it))
}
if (it.caplayer)
{
- it.classname = STR_PLAYER;
+ TRANSMUTE(Player, it);
it.caplayer = 1;
- WITH(entity, self, it, PutClientInServer());
+ WITHSELF(it, PutClientInServer());
}
});
return true;
MUTATOR_HOOKFUNCTION(ca, ClientConnect)
{
SELFPARAM();
- this.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, this);
return true;
}
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
-#ifndef GAMEMODE_CTF_H
-#define GAMEMODE_CTF_H
+#include "gamemode_ctf.qh"
+#ifdef IMPLEMENTATION
#ifndef CSQC
void ctf_Initialize();
}
#endif
-#ifdef SVQC
-// used in cheats.qc
-void ctf_RespawnFlag(entity flag);
-
-// score rule declarations
-const int ST_CTF_CAPS = 1;
-const int SP_CTF_CAPS = 4;
-const int SP_CTF_CAPTIME = 5;
-const int SP_CTF_PICKUPS = 6;
-const int SP_CTF_DROPS = 7;
-const int SP_CTF_FCKILLS = 8;
-const int SP_CTF_RETURNS = 9;
-
-CLASS(Flag, Pickup)
- ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13')
- ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
-ENDCLASS(Flag)
-Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
-void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
-
-// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
-
-const float FLAG_SCALE = 0.6;
-
-const float FLAG_THINKRATE = 0.2;
-const float FLAG_TOUCHRATE = 0.5;
-const float WPFE_THINKRATE = 0.5;
-
-const vector FLAG_DROP_OFFSET = ('0 0 32');
-const vector FLAG_CARRY_OFFSET = ('-16 0 8');
-#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
-const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
-const vector FLAG_FLOAT_OFFSET = ('0 0 32');
-const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
-
-const vector VEHICLE_FLAG_OFFSET = ('0 0 96');
-const float VEHICLE_FLAG_SCALE = 1.0;
-
-// waypoint colors
-#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
-#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color)
-#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1')
-
-// sounds
-#define snd_flag_taken noise
-#define snd_flag_returned noise1
-#define snd_flag_capture noise2
-#define snd_flag_respawn noise3
-.string snd_flag_dropped;
-.string snd_flag_touch;
-.string snd_flag_pass;
-
-// effects
-.string toucheffect;
-.string passeffect;
-.string capeffect;
-
-// list of flags on the map
-entity ctf_worldflaglist;
-.entity ctf_worldflagnext;
-.entity ctf_staleflagnext;
-
-// waypoint sprites
-.entity bot_basewaypoint; // flag waypointsprite
-.entity wps_helpme;
-.entity wps_flagbase;
-.entity wps_flagcarrier;
-.entity wps_flagdropped;
-.entity wps_enemyflagcarrier;
-.float wps_helpme_time;
-bool wpforenemy_announced;
-float wpforenemy_nextthink;
-
-// statuses
-const int FLAG_BASE = 1;
-const int FLAG_DROPPED = 2;
-const int FLAG_CARRY = 3;
-const int FLAG_PASSING = 4;
-
-const int DROP_NORMAL = 1;
-const int DROP_THROW = 2;
-const int DROP_PASS = 3;
-const int DROP_RESET = 4;
-
-const int PICKUP_BASE = 1;
-const int PICKUP_DROPPED = 2;
-
-const int CAPTURE_NORMAL = 1;
-const int CAPTURE_DROPPED = 2;
-
-const int RETURN_TIMEOUT = 1;
-const int RETURN_DROPPED = 2;
-const int RETURN_DAMAGE = 3;
-const int RETURN_SPEEDRUN = 4;
-const int RETURN_NEEDKILL = 5;
-
-void ctf_Handle_Throw(entity player, entity receiver, float droptype);
-
-// flag properties
-#define ctf_spawnorigin dropped_origin
-bool ctf_stalemate; // indicates that a stalemate is active
-float ctf_captimerecord; // record time for capturing the flag
-.float ctf_pickuptime;
-.float ctf_droptime;
-.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
-.entity ctf_dropper; // don't allow spam of dropping the flag
-.int max_flag_health;
-.float next_take_time;
-.bool ctf_flagdamaged;
-int ctf_teams;
-
-// passing/throwing properties
-.float pass_distance;
-.entity pass_sender;
-.entity pass_target;
-.float throw_antispam;
-.float throw_prevtime;
-.int throw_count;
-
-// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
-.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
-float ctf_captureshield_min_negscore; // punish at -20 points
-float ctf_captureshield_max_ratio; // punish at most 30% of each team
-float ctf_captureshield_force; // push force of the shield
-
-// 1 flag ctf
-bool ctf_oneflag; // indicates whether or not a neutral flag has been found
-
-// bot player logic
-const int HAVOCBOT_CTF_ROLE_NONE = 0;
-const int HAVOCBOT_CTF_ROLE_DEFENSE = 2;
-const int HAVOCBOT_CTF_ROLE_MIDDLE = 4;
-const int HAVOCBOT_CTF_ROLE_OFFENSE = 8;
-const int HAVOCBOT_CTF_ROLE_CARRIER = 16;
-const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32;
-const int HAVOCBOT_CTF_ROLE_ESCORT = 64;
-
-.bool havocbot_cantfindflag;
-
-vector havocbot_ctf_middlepoint;
-float havocbot_ctf_middlepoint_radius;
-
-void havocbot_role_ctf_setrole(entity bot, int role);
-
-// team checking
-#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
-#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
-
-// networked flag statuses
-.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS);
-#endif
-
-const int CTF_RED_FLAG_TAKEN = 1;
-const int CTF_RED_FLAG_LOST = 2;
-const int CTF_RED_FLAG_CARRYING = 3;
-const int CTF_BLUE_FLAG_TAKEN = 4;
-const int CTF_BLUE_FLAG_LOST = 8;
-const int CTF_BLUE_FLAG_CARRYING = 12;
-const int CTF_YELLOW_FLAG_TAKEN = 16;
-const int CTF_YELLOW_FLAG_LOST = 32;
-const int CTF_YELLOW_FLAG_CARRYING = 48;
-const int CTF_PINK_FLAG_TAKEN = 64;
-const int CTF_PINK_FLAG_LOST = 128;
-const int CTF_PINK_FLAG_CARRYING = 192;
-const int CTF_NEUTRAL_FLAG_TAKEN = 256;
-const int CTF_NEUTRAL_FLAG_LOST = 512;
-const int CTF_NEUTRAL_FLAG_CARRYING = 768;
-const int CTF_FLAG_NEUTRAL = 2048;
-const int CTF_SHIELDED = 4096;
-#endif
-
-#ifdef IMPLEMENTATION
-
#ifdef SVQC
#include <common/vehicles/all.qh>
#include <server/teamplay.qh>
// Event Handlers
// ==============
+void nades_GiveBonus(entity player, float score);
+
void ctf_Handle_Capture(entity flag, entity toucher, int capturetype)
{
entity enemy_flag = ((capturetype == CAPTURE_NORMAL) ? toucher.flagcarried : toucher);
ctf_RespawnFlag(this);
}
-void ctf_DelayedFlagSetup() // called after a flag is placed on a map by ctf_FlagSetup()
-{SELFPARAM();
+void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map by ctf_FlagSetup()
+{
// bot waypoints
waypoint_spawnforitem_force(self, self.origin);
self.nearestwaypointtimeout = 0; // activate waypointing again
ctf_CaptureShield_Spawn(self);
}
+.bool pushable;
+
void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
-{SELFPARAM();
+{
// declarations
setself(flag); // for later usage with droptofloor()
return c;
}
-void havocbot_goalrating_ctf_ourflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourflag(entity this, float ratingscale)
+{
entity head;
head = ctf_worldflaglist;
while (head)
{
- if (CTF_SAMETEAM(self, head))
+ if (CTF_SAMETEAM(this, head))
break;
head = head.ctf_worldflagnext;
}
if (head)
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(this, head, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_ourbase(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourbase(entity this, float ratingscale)
+{
entity head;
head = ctf_worldflaglist;
while (head)
{
- if (CTF_SAMETEAM(self, head))
+ if (CTF_SAMETEAM(this, head))
break;
head = head.ctf_worldflagnext;
}
if (!head)
return;
- navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
+ navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_enemyflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale)
+{
entity head;
head = ctf_worldflaglist;
while (head)
{
if(ctf_oneflag)
{
- if(CTF_DIFFTEAM(self, head))
+ if(CTF_DIFFTEAM(this, head))
{
if(head.team)
{
- if(self.flagcarried)
+ if(this.flagcarried)
break;
}
- else if(!self.flagcarried)
+ else if(!this.flagcarried)
break;
}
}
- else if(CTF_DIFFTEAM(self, head))
+ else if(CTF_DIFFTEAM(this, head))
break;
head = head.ctf_worldflagnext;
}
if (head)
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(this, head, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_enemybase(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_enemybase(entity this, float ratingscale)
+{
if (!bot_waypoints_for_items)
{
- havocbot_goalrating_ctf_enemyflag(ratingscale);
+ havocbot_goalrating_ctf_enemyflag(this, ratingscale);
return;
}
entity head;
- head = havocbot_ctf_find_enemy_flag(self);
+ head = havocbot_ctf_find_enemy_flag(this);
if (!head)
return;
- navigation_routerating(head.bot_basewaypoint, ratingscale, 10000);
+ navigation_routerating(this, head.bot_basewaypoint, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
-{SELFPARAM();
+void havocbot_goalrating_ctf_ourstolenflag(entity this, float ratingscale)
+{
entity mf;
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status == FLAG_BASE)
return;
if(mf.tag_entity)
- navigation_routerating(mf.tag_entity, ratingscale, 10000);
+ navigation_routerating(this, mf.tag_entity, ratingscale, 10000);
}
-void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float df_radius)
+void havocbot_goalrating_ctf_droppedflags(entity this, float ratingscale, vector org, float df_radius)
{
entity head;
head = ctf_worldflaglist;
if(df_radius)
{
if(vlen(org-head.origin)<df_radius)
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(self, head, ratingscale, 10000);
}
else
- navigation_routerating(head, ratingscale, 10000);
+ navigation_routerating(self, head, ratingscale, 10000);
}
head = head.ctf_worldflagnext;
}
}
-void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius)
-{SELFPARAM();
+void havocbot_goalrating_ctf_carrieritems(entity this, float ratingscale, vector org, float sradius)
+{
entity head;
float t;
head = findchainfloat(bot_pickup, true);
if (vlen(head.origin - org) < sradius)
{
// get the value of the item
- t = head.bot_pickupevalfunc(self, head) * 0.0001;
+ t = head.bot_pickupevalfunc(this, head) * 0.0001;
if (t > 0)
- navigation_routerating(head, t * ratingscale, 500);
+ navigation_routerating(this, head, t * ratingscale, 500);
}
head = head.chain;
}
}
-void havocbot_ctf_reset_role(entity bot)
+void havocbot_ctf_reset_role(entity this)
{
float cdefense, cmiddle, coffense;
entity mf, ef;
float c;
- if(IS_DEAD(bot))
+ if(IS_DEAD(this))
return;
- if(vlen(havocbot_ctf_middlepoint)==0)
+ if(havocbot_ctf_middlepoint == '0 0 0')
havocbot_calculate_middlepoint();
// Check ctf flags
- if (bot.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
- mf = havocbot_ctf_find_flag(bot);
- ef = havocbot_ctf_find_enemy_flag(bot);
+ mf = havocbot_ctf_find_flag(this);
+ ef = havocbot_ctf_find_enemy_flag(this);
// Retrieve stolen flag
if(mf.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
// If enemy flag is taken go to the middle to intercept pursuers
if(ef.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
return;
}
// if there is only me on the team switch to offense
c = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, bot), LAMBDA(++c));
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this), LAMBDA(++c));
if(c==1)
{
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE);
return;
}
// Evaluate best position to take
// Count mates on middle position
- cmiddle = havocbot_ctf_teamcount(bot, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5);
+ cmiddle = havocbot_ctf_teamcount(this, havocbot_ctf_middlepoint, havocbot_ctf_middlepoint_radius * 0.5);
// Count mates on defense position
- cdefense = havocbot_ctf_teamcount(bot, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5);
+ cdefense = havocbot_ctf_teamcount(this, mf.dropped_origin, havocbot_ctf_middlepoint_radius * 0.5);
// Count mates on offense position
- coffense = havocbot_ctf_teamcount(bot, ef.dropped_origin, havocbot_ctf_middlepoint_radius);
+ coffense = havocbot_ctf_teamcount(this, ef.dropped_origin, havocbot_ctf_middlepoint_radius);
if(cdefense<=coffense)
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_DEFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
else if(coffense<=cmiddle)
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_OFFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_OFFENSE);
else
- havocbot_role_ctf_setrole(bot, HAVOCBOT_CTF_ROLE_MIDDLE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
}
-void havocbot_role_ctf_carrier()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ctf_carrier(entity this)
+{
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried == world)
+ if (this.flagcarried == world)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ navigation_goalrating_start(this);
if(ctf_oneflag)
- havocbot_goalrating_ctf_enemybase(50000);
+ havocbot_goalrating_ctf_enemybase(this, 50000);
else
- havocbot_goalrating_ctf_ourbase(50000);
+ havocbot_goalrating_ctf_ourbase(this, 50000);
- if(self.health<100)
- havocbot_goalrating_ctf_carrieritems(1000, self.origin, 1000);
+ if(this.health<100)
+ havocbot_goalrating_ctf_carrieritems(this, 1000, this.origin, 1000);
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
- if (self.navigation_hasgoals)
- self.havocbot_cantfindflag = time + 10;
- else if (time > self.havocbot_cantfindflag)
+ if (this.navigation_hasgoals)
+ this.havocbot_cantfindflag = time + 10;
+ else if (time > this.havocbot_cantfindflag)
{
// Can't navigate to my own base, suicide!
// TODO: drop it and wander around
- Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+ Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
return;
}
}
}
-void havocbot_role_ctf_escort()
-{SELFPARAM();
+void havocbot_role_ctf_escort(entity this)
+{
entity mf, ef;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// If enemy flag is back on the base switch to previous role
- ef = havocbot_ctf_find_enemy_flag(self);
+ ef = havocbot_ctf_find_enemy_flag(this);
if(ef.ctf_status==FLAG_BASE)
{
- self.havocbot_role = self.havocbot_previous_role;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = this.havocbot_previous_role;
+ this.havocbot_role_timeout = 0;
return;
}
// If the flag carrier reached the base switch to defense
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status!=FLAG_BASE)
if(vlen(ef.origin - mf.dropped_origin) < 300)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_DEFENSE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_DEFENSE);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
+ if (!this.havocbot_role_timeout)
{
- self.havocbot_role_timeout = time + random() * 30 + 60;
+ this.havocbot_role_timeout = time + random() * 30 + 60;
}
// If nothing happened just switch to previous role
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- self.havocbot_role = self.havocbot_previous_role;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = this.havocbot_previous_role;
+ this.havocbot_role_timeout = 0;
return;
}
// Chase the flag carrier
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_enemyflag(30000);
- havocbot_goalrating_ctf_ourstolenflag(40000);
- havocbot_goalrating_items(10000, self.origin, 10000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_enemyflag(this, 30000);
+ havocbot_goalrating_ctf_ourstolenflag(this, 40000);
+ havocbot_goalrating_items(this, 10000, this.origin, 10000);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ctf_offense()
-{SELFPARAM();
+void havocbot_role_ctf_offense(entity this)
+{
entity mf, ef;
vector pos;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// Check flags
- mf = havocbot_ctf_find_flag(self);
- ef = havocbot_ctf_find_enemy_flag(self);
+ mf = havocbot_ctf_find_flag(this);
+ ef = havocbot_ctf_find_enemy_flag(this);
// Own flag stolen
if(mf.ctf_status!=FLAG_BASE)
pos = mf.origin;
// Try to get it if closer than the enemy base
- if(vlen(self.origin-ef.dropped_origin)>vlen(self.origin-pos))
+ if(vlen(this.origin-ef.dropped_origin)>vlen(this.origin-pos))
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
}
if(vlen(pos-mf.dropped_origin)>700)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_ESCORT);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_ESCORT);
return;
}
}
// About to fail, switch to middlefield
- if(self.health<50)
+ if(this.health<50)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_MIDDLE);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_MIDDLE);
return;
}
// Set the role timeout if necessary
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 120;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 120;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_ourstolenflag(50000);
- havocbot_goalrating_ctf_enemybase(20000);
- havocbot_goalrating_items(5000, self.origin, 1000);
- havocbot_goalrating_items(1000, self.origin, 10000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+ havocbot_goalrating_ctf_enemybase(this, 20000);
+ havocbot_goalrating_items(this, 5000, this.origin, 1000);
+ havocbot_goalrating_items(this, 1000, this.origin, 10000);
+ navigation_goalrating_end(this);
}
}
// Retriever (temporary role):
-void havocbot_role_ctf_retriever()
-{SELFPARAM();
+void havocbot_role_ctf_retriever(entity this)
+{
entity mf;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// If flag is back on the base switch to previous role
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status==FLAG_BASE)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 20;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 20;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float rt_radius;
rt_radius = 10000;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_ourstolenflag(50000);
- havocbot_goalrating_ctf_droppedflags(40000, self.origin, rt_radius);
- havocbot_goalrating_ctf_enemybase(30000);
- havocbot_goalrating_items(500, self.origin, rt_radius);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+ havocbot_goalrating_ctf_droppedflags(this, 40000, this.origin, rt_radius);
+ havocbot_goalrating_ctf_enemybase(this, 30000);
+ havocbot_goalrating_items(this, 500, this.origin, rt_radius);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ctf_middle()
-{SELFPARAM();
+void havocbot_role_ctf_middle(entity this)
+{
entity mf;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 10;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 10;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
vector org;
org = havocbot_ctf_middlepoint;
- org.z = self.origin.z;
+ org.z = this.origin.z;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_ctf_ourstolenflag(50000);
- havocbot_goalrating_ctf_droppedflags(30000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(10000, org, havocbot_ctf_middlepoint_radius * 0.5);
- havocbot_goalrating_items(5000, org, havocbot_ctf_middlepoint_radius * 0.5);
- havocbot_goalrating_items(2500, self.origin, 10000);
- havocbot_goalrating_ctf_enemybase(2500);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_ctf_ourstolenflag(this, 50000);
+ havocbot_goalrating_ctf_droppedflags(this, 30000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 10000, org, havocbot_ctf_middlepoint_radius * 0.5);
+ havocbot_goalrating_items(this, 5000, org, havocbot_ctf_middlepoint_radius * 0.5);
+ havocbot_goalrating_items(this, 2500, this.origin, 10000);
+ havocbot_goalrating_ctf_enemybase(this, 2500);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ctf_defense()
-{SELFPARAM();
+void havocbot_role_ctf_defense(entity this)
+{
entity mf;
- if(IS_DEAD(self))
+ if(IS_DEAD(this))
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.flagcarried)
+ if (this.flagcarried)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_CARRIER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_CARRIER);
return;
}
// If own flag was captured
- mf = havocbot_ctf_find_flag(self);
+ mf = havocbot_ctf_find_flag(this);
if(mf.ctf_status!=FLAG_BASE)
{
- havocbot_role_ctf_setrole(self, HAVOCBOT_CTF_ROLE_RETRIEVER);
+ havocbot_role_ctf_setrole(this, HAVOCBOT_CTF_ROLE_RETRIEVER);
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + 30;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + 30;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
- havocbot_ctf_reset_role(self);
+ havocbot_ctf_reset_role(this);
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float mp_radius;
vector org;
org = mf.dropped_origin;
mp_radius = havocbot_ctf_middlepoint_radius;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
// if enemies are closer to our base, go there
entity closestplayer = world;
));
if(closestplayer)
- if(DIFF_TEAM(closestplayer, self))
- if(vlen(org - self.origin)>1000)
- if(checkpvs(self.origin,closestplayer)||random()<0.5)
- havocbot_goalrating_ctf_ourbase(30000);
+ if(DIFF_TEAM(closestplayer, this))
+ if(vlen(org - this.origin)>1000)
+ if(checkpvs(this.origin,closestplayer)||random()<0.5)
+ havocbot_goalrating_ctf_ourbase(this, 30000);
- havocbot_goalrating_ctf_ourstolenflag(20000);
- havocbot_goalrating_ctf_droppedflags(20000, org, mp_radius);
- havocbot_goalrating_enemyplayers(15000, org, mp_radius);
- havocbot_goalrating_items(10000, org, mp_radius);
- havocbot_goalrating_items(5000, self.origin, 10000);
- navigation_goalrating_end();
+ havocbot_goalrating_ctf_ourstolenflag(this, 20000);
+ havocbot_goalrating_ctf_droppedflags(this, 20000, org, mp_radius);
+ havocbot_goalrating_enemyplayers(this, 15000, org, mp_radius);
+ havocbot_goalrating_items(this, 10000, org, mp_radius);
+ havocbot_goalrating_items(this, 5000, this.origin, 10000);
+ navigation_goalrating_end(this);
}
}
void superspec_msg(string _center_title, string _con_title, entity _to, string _msg, float _spamlevel); // TODO
MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand)
{
+ SELFPARAM();
if(IS_PLAYER(self) || MUTATOR_RETURNVALUE || !cvar("g_superspectate")) { return false; }
if(cmd_name == "followfc")
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_ctf_team(this));
+ WITHSELF(this, spawnfunc_ctf_team(this));
}
-void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
ctf_teams = 2;
--- /dev/null
+#pragma once
+
+#ifdef SVQC
+
+#include "../gamemode.qh"
+// used in cheats.qc
+void ctf_RespawnFlag(entity flag);
+
+// score rule declarations
+const int ST_CTF_CAPS = 1;
+const int SP_CTF_CAPS = 4;
+const int SP_CTF_CAPTIME = 5;
+const int SP_CTF_PICKUPS = 6;
+const int SP_CTF_DROPS = 7;
+const int SP_CTF_FCKILLS = 8;
+const int SP_CTF_RETURNS = 9;
+
+CLASS(Flag, Pickup)
+ ATTRIB(Flag, m_mins, vector, PL_MIN_CONST + '0 0 -13')
+ ATTRIB(Flag, m_maxs, vector, PL_MAX_CONST + '0 0 -13')
+ENDCLASS(Flag)
+Flag CTF_FLAG; STATIC_INIT(Flag) { CTF_FLAG = NEW(Flag); }
+void ctf_FlagTouch() { SELFPARAM(); ITEM_HANDLE(Pickup, CTF_FLAG, this, other); }
+
+// flag constants // for most of these, there is just one question to be asked: WHYYYYY?
+
+const float FLAG_SCALE = 0.6;
+
+const float FLAG_THINKRATE = 0.2;
+const float FLAG_TOUCHRATE = 0.5;
+const float WPFE_THINKRATE = 0.5;
+
+const vector FLAG_DROP_OFFSET = ('0 0 32');
+const vector FLAG_CARRY_OFFSET = ('-16 0 8');
+#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13))
+const vector FLAG_WAYPOINT_OFFSET = ('0 0 64');
+const vector FLAG_FLOAT_OFFSET = ('0 0 32');
+const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10');
+
+const vector VEHICLE_FLAG_OFFSET = ('0 0 96');
+const float VEHICLE_FLAG_SCALE = 1.0;
+
+// waypoint colors
+#define WPCOLOR_ENEMYFC(t) ((t) ? colormapPaletteColor(t - 1, false) * 0.75 : '1 1 1')
+#define WPCOLOR_FLAGCARRIER(t) (WP_FlagCarrier.m_color)
+#define WPCOLOR_DROPPEDFLAG(t) ((t) ? ('0.25 0.25 0.25' + colormapPaletteColor(t - 1, false)) * 0.5 : '1 1 1')
+
+// sounds
+#define snd_flag_taken noise
+#define snd_flag_returned noise1
+#define snd_flag_capture noise2
+#define snd_flag_respawn noise3
+.string snd_flag_dropped;
+.string snd_flag_touch;
+.string snd_flag_pass;
+
+// effects
+.string toucheffect;
+.string passeffect;
+.string capeffect;
+
+// list of flags on the map
+entity ctf_worldflaglist;
+.entity ctf_worldflagnext;
+.entity ctf_staleflagnext;
+
+// waypoint sprites
+.entity bot_basewaypoint; // flag waypointsprite
+.entity wps_helpme;
+.entity wps_flagbase;
+.entity wps_flagcarrier;
+.entity wps_flagdropped;
+.entity wps_enemyflagcarrier;
+.float wps_helpme_time;
+bool wpforenemy_announced;
+float wpforenemy_nextthink;
+
+// statuses
+const int FLAG_BASE = 1;
+const int FLAG_DROPPED = 2;
+const int FLAG_CARRY = 3;
+const int FLAG_PASSING = 4;
+
+const int DROP_NORMAL = 1;
+const int DROP_THROW = 2;
+const int DROP_PASS = 3;
+const int DROP_RESET = 4;
+
+const int PICKUP_BASE = 1;
+const int PICKUP_DROPPED = 2;
+
+const int CAPTURE_NORMAL = 1;
+const int CAPTURE_DROPPED = 2;
+
+const int RETURN_TIMEOUT = 1;
+const int RETURN_DROPPED = 2;
+const int RETURN_DAMAGE = 3;
+const int RETURN_SPEEDRUN = 4;
+const int RETURN_NEEDKILL = 5;
+
+void ctf_Handle_Throw(entity player, entity receiver, float droptype);
+
+// flag properties
+#define ctf_spawnorigin dropped_origin
+bool ctf_stalemate; // indicates that a stalemate is active
+float ctf_captimerecord; // record time for capturing the flag
+.float ctf_pickuptime;
+.float ctf_droptime;
+.int ctf_status; // status of the flag (FLAG_BASE, FLAG_DROPPED, FLAG_CARRY declared globally)
+.entity ctf_dropper; // don't allow spam of dropping the flag
+.int max_flag_health;
+.float next_take_time;
+.bool ctf_flagdamaged;
+int ctf_teams;
+
+// passing/throwing properties
+.float pass_distance;
+.entity pass_sender;
+.entity pass_target;
+.float throw_antispam;
+.float throw_prevtime;
+.int throw_count;
+
+// CaptureShield: If the player is too bad to be allowed to capture, shield them from taking the flag.
+.bool ctf_captureshielded; // set to 1 if the player is too bad to be allowed to capture
+float ctf_captureshield_min_negscore; // punish at -20 points
+float ctf_captureshield_max_ratio; // punish at most 30% of each team
+float ctf_captureshield_force; // push force of the shield
+
+// 1 flag ctf
+bool ctf_oneflag; // indicates whether or not a neutral flag has been found
+
+// bot player logic
+const int HAVOCBOT_CTF_ROLE_NONE = 0;
+const int HAVOCBOT_CTF_ROLE_DEFENSE = 2;
+const int HAVOCBOT_CTF_ROLE_MIDDLE = 4;
+const int HAVOCBOT_CTF_ROLE_OFFENSE = 8;
+const int HAVOCBOT_CTF_ROLE_CARRIER = 16;
+const int HAVOCBOT_CTF_ROLE_RETRIEVER = 32;
+const int HAVOCBOT_CTF_ROLE_ESCORT = 64;
+
+.bool havocbot_cantfindflag;
+
+vector havocbot_ctf_middlepoint;
+float havocbot_ctf_middlepoint_radius;
+
+void havocbot_role_ctf_setrole(entity bot, int role);
+
+// team checking
+#define CTF_SAMETEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? DIFF_TEAM(a,b) : SAME_TEAM(a,b))
+#define CTF_DIFFTEAM(a,b) ((autocvar_g_ctf_reverse || (ctf_oneflag && autocvar_g_ctf_oneflag_reverse)) ? SAME_TEAM(a,b) : DIFF_TEAM(a,b))
+
+// networked flag statuses
+.int ctf_flagstatus = _STAT(CTF_FLAGSTATUS);
+#endif
+
+const int CTF_RED_FLAG_TAKEN = 1;
+const int CTF_RED_FLAG_LOST = 2;
+const int CTF_RED_FLAG_CARRYING = 3;
+const int CTF_BLUE_FLAG_TAKEN = 4;
+const int CTF_BLUE_FLAG_LOST = 8;
+const int CTF_BLUE_FLAG_CARRYING = 12;
+const int CTF_YELLOW_FLAG_TAKEN = 16;
+const int CTF_YELLOW_FLAG_LOST = 32;
+const int CTF_YELLOW_FLAG_CARRYING = 48;
+const int CTF_PINK_FLAG_TAKEN = 64;
+const int CTF_PINK_FLAG_LOST = 128;
+const int CTF_PINK_FLAG_CARRYING = 192;
+const int CTF_NEUTRAL_FLAG_TAKEN = 256;
+const int CTF_NEUTRAL_FLAG_LOST = 512;
+const int CTF_NEUTRAL_FLAG_CARRYING = 768;
+const int CTF_FLAG_NEUTRAL = 2048;
+const int CTF_SHIELDED = 4096;
+#include "gamemode_cts.qh"
#include <server/race.qh>
#ifndef GAMEMODE_CTS_H
// legacy bot roles
.float race_checkpoint;
-void havocbot_role_cts()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_cts(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
FOREACH_ENTITY_CLASS("trigger_race_checkpoint", true,
{
- if(it.cnt == self.race_checkpoint)
- navigation_routerating(it, 1000000, 5000);
- else if(self.race_checkpoint == -1)
- navigation_routerating(it, 1000000, 5000);
+ if(it.cnt == this.race_checkpoint)
+ navigation_routerating(this, it, 1000000, 5000);
+ else if(this.race_checkpoint == -1)
+ navigation_routerating(this, it, 1000000, 5000);
});
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
}
}
GameLogEcho(strcat(":cts:", mode, ":", ((actor != world) ? (strcat(":", ftos(actor.playerid))) : "")));
}
+void KillIndicator_Think();
void CTS_ClientKill(entity e) // silent version of ClientKill, used when player finishes a CTS run. Useful to prevent cheating by running back to the start line and starting out with more speed
{
e.killindicator = spawn();
return false;
}
+void ClientKill_Now();
MUTATOR_HOOKFUNCTION(cts, ClientKill)
{
+ SELFPARAM();
ret_float = 0;
if(self.killindicator && self.killindicator.health == 1) // self.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_deathmatch.qh"
#ifndef GAMEMODE_DEATHMATCH_H
#define GAMEMODE_DEATHMATCH_H
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_domination.qh"
#ifndef GAMEMODE_DOMINATION_H
#define GAMEMODE_DOMINATION_H
}
//go to best items, or control points you don't own
-void havocbot_role_dom()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_dom(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_controlpoints(10000, self.origin, 15000);
- havocbot_goalrating_items(8000, self.origin, 8000);
- //havocbot_goalrating_enemyplayers(3000, self.origin, 2000);
- //havocbot_goalrating_waypoints(1, self.origin, 1000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
+ havocbot_goalrating_controlpoints(this, 10000, this.origin, 15000);
+ havocbot_goalrating_items(this, 8000, this.origin, 8000);
+ //havocbot_goalrating_enemyplayers(this, 3000, this.origin, 2000);
+ //havocbot_goalrating_waypoints(1, this.origin, 1000);
+ navigation_goalrating_end(this);
}
}
}
// code from here on is just to support maps that don't have control point and team entities
-void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage)
+void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, Sound capsound, string capnarration, string capmessage)
{SELFPARAM();
+ TC(Sound, capsound);
setself(spawn());
self.classname = "dom_team";
self.netname = strzone(teamname);
self.cnt = teamcolor;
self.model = pointmodel;
self.skin = pointskin;
- self.noise = strzone(capsound);
+ self.noise = strzone(Sound_fixpath(capsound));
self.noise1 = strzone(capnarration);
self.message = strzone(capmessage);
}
// spawn some default teams if the map is not set up for domination
-void dom_spawnteams(float teams)
+void dom_spawnteams(int teams)
{
- dom_spawnteam(Team_ColoredFullName(NUM_TEAM_1), NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND(DOM_CLAIM), "", "Red team has captured a control point");
- dom_spawnteam(Team_ColoredFullName(NUM_TEAM_2), NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND(DOM_CLAIM), "", "Blue team has captured a control point");
+ TC(int, teams);
+ dom_spawnteam(Team_ColoredFullName(NUM_TEAM_1), NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, SND_DOM_CLAIM, "", "Red team has captured a control point");
+ dom_spawnteam(Team_ColoredFullName(NUM_TEAM_2), NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, SND_DOM_CLAIM, "", "Blue team has captured a control point");
if(teams >= 3)
- dom_spawnteam(Team_ColoredFullName(NUM_TEAM_3), NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND(DOM_CLAIM), "", "Yellow team has captured a control point");
+ dom_spawnteam(Team_ColoredFullName(NUM_TEAM_3), NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, SND_DOM_CLAIM, "", "Yellow team has captured a control point");
if(teams >= 4)
- dom_spawnteam(Team_ColoredFullName(NUM_TEAM_4), NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND(DOM_CLAIM), "", "Pink team has captured a control point");
- dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
+ dom_spawnteam(Team_ColoredFullName(NUM_TEAM_4), NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, SND_DOM_CLAIM, "", "Pink team has captured a control point");
+ dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, SND_Null, "", "");
}
-void dom_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void dom_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
// if no teams are found, spawn defaults
if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_freezetag.qh"
#ifndef GAMEMODE_FREEZETAG_H
#define GAMEMODE_FREEZETAG_H
// Bot player logic
// ================
-void() havocbot_role_ft_freeing;
-void() havocbot_role_ft_offense;
+void(entity this) havocbot_role_ft_freeing;
+void(entity this) havocbot_role_ft_offense;
-void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradius)
-{SELFPARAM();
- float distance;
-
- FOREACH_CLIENT(IS_PLAYER(it) && it != self && SAME_TEAM(it, self), LAMBDA(
+void havocbot_goalrating_freeplayers(entity this, float ratingscale, vector org, float sradius)
+{
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), LAMBDA(
if (STAT(FROZEN, it) == 1)
{
- distance = vlen(it.origin - org);
- if (distance > sradius)
+ if(vdist(it.origin - org, >, sradius))
continue;
- navigation_routerating(it, ratingscale, 2000);
+ navigation_routerating(this, it, ratingscale, 2000);
}
else
{
// If teamate is not frozen still seek them out as fight better
// in a group.
- navigation_routerating(it, ratingscale/3, 2000);
+ navigation_routerating(this, it, ratingscale/3, 2000);
}
));
}
-void havocbot_role_ft_offense()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ft_offense(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + random() * 10 + 20;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + random() * 10 + 20;
// Count how many players on team are unfrozen.
int unfrozen = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, self) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++));
+ FOREACH_CLIENT(IS_PLAYER(it) && SAME_TEAM(it, this) && !(STAT(FROZEN, it) != 1), LAMBDA(unfrozen++));
// If only one left on team or if role has timed out then start trying to free players.
- if (((unfrozen == 0) && (!STAT(FROZEN, self))) || (time > self.havocbot_role_timeout))
+ if (((unfrozen == 0) && (!STAT(FROZEN, this))) || (time > this.havocbot_role_timeout))
{
LOG_TRACE("changing role to freeing\n");
- self.havocbot_role = havocbot_role_ft_freeing;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ft_freeing;
+ this.havocbot_role_timeout = 0;
return;
}
- if (time > self.bot_strategytime)
+ if (time > this.bot_strategytime)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-
- navigation_goalrating_start();
- havocbot_goalrating_items(10000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
- havocbot_goalrating_freeplayers(9000, self.origin, 10000);
- //havocbot_goalrating_waypoints(1, self.origin, 1000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+
+ navigation_goalrating_start(this);
+ havocbot_goalrating_items(this, 10000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 20000, this.origin, 10000);
+ havocbot_goalrating_freeplayers(this, 9000, this.origin, 10000);
+ //havocbot_goalrating_waypoints(1, this.origin, 1000);
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_ft_freeing()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_ft_freeing(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + random() * 10 + 20;
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + random() * 10 + 20;
- if (time > self.havocbot_role_timeout)
+ if (time > this.havocbot_role_timeout)
{
LOG_TRACE("changing role to offense\n");
- self.havocbot_role = havocbot_role_ft_offense;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_ft_offense;
+ this.havocbot_role_timeout = 0;
return;
}
- if (time > self.bot_strategytime)
+ if (time > this.bot_strategytime)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-
- navigation_goalrating_start();
- havocbot_goalrating_items(8000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(10000, self.origin, 10000);
- havocbot_goalrating_freeplayers(20000, self.origin, 10000);
- //havocbot_goalrating_waypoints(1, self.origin, 1000);
- navigation_goalrating_end();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+
+ navigation_goalrating_start(this);
+ havocbot_goalrating_items(this, 8000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 10000, this.origin, 10000);
+ havocbot_goalrating_freeplayers(this, 20000, this.origin, 10000);
+ //havocbot_goalrating_waypoints(1, this.origin, 1000);
+ navigation_goalrating_end(this);
}
}
}
MUTATOR_HOOKFUNCTION(ft, ClientDisconnect)
-{SELFPARAM();
+{
ft_RemovePlayer();
return 1;
}
MUTATOR_HOOKFUNCTION(ft, MakePlayerObserver)
-{SELFPARAM();
+{
ft_RemovePlayer();
return false;
}
MUTATOR_HOOKFUNCTION(ft, PlayerDies)
{
+ SELFPARAM();
if(round_handler_IsActive())
if(round_handler_CountdownRunning())
{
if(STAT(FROZEN, frag_target))
- WITH(entity, self, frag_target, freezetag_Unfreeze(world));
+ WITHSELF(frag_target, freezetag_Unfreeze(world));
freezetag_count_alive_players();
return 1; // let the player die so that he can respawn whenever he wants
}
freezetag_LastPlayerForTeam_Notify();
}
else
- WITH(entity, self, frag_target, freezetag_Unfreeze(world)); // remove ice
+ WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice
frag_target.health = 0; // Unfreeze resets health
frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
return 1;
if(STAT(FROZEN, frag_target))
return 1;
- WITH(entity, self, frag_target, freezetag_Freeze(frag_attacker));
+ WITHSELF(frag_target, freezetag_Freeze(frag_attacker));
freezetag_LastPlayerForTeam_Notify();
if(frag_attacker == frag_target || frag_attacker == world)
}
MUTATOR_HOOKFUNCTION(ft, reset_map_players)
-{SELFPARAM();
+{
FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(
it.killcount = 0;
it.freezetag_frozen_timeout = -1;
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_invasion.qh"
#ifndef GAMEMODE_INVASION_H
#define GAMEMODE_INVASION_H
ScoreRules_basics_end();
}
-void invasion_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
+void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
{
if(autocvar_g_invasion_teams)
invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_keepaway.qh"
#ifndef GAMEMODE_KEEPAWAY_H
#define GAMEMODE_KEEPAWAY_H
const float SP_KEEPAWAY_CARRIERKILLS = 5;
const float SP_KEEPAWAY_BCTIME = 6;
-void() havocbot_role_ka_carrier;
-void() havocbot_role_ka_collector;
+void(entity this) havocbot_role_ka_carrier;
+void(entity this) havocbot_role_ka_collector;
void ka_DropEvent(entity plyr);
#endif
}
void ka_TouchEvent();
-void ka_RespawnBall() // runs whenever the ball needs to be relocated
-{SELFPARAM();
+void ka_RespawnBall(entity this) // runs whenever the ball needs to be relocated
+{
if(gameover) { return; }
vector oldballorigin = self.origin;
self.angles = '0 0 0';
self.effects = autocvar_g_keepawayball_effects;
self.touch = ka_TouchEvent;
- self.think = ka_RespawnBall;
+ setthink(self, ka_RespawnBall);
self.nextthink = time + autocvar_g_keepawayball_respawntime;
Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
if(!self) { return; }
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{ // The ball fell off the map, respawn it since players can't get to it
- ka_RespawnBall();
+ ka_RespawnBall(self);
return;
}
if(IS_DEAD(other)) { return; }
ball.movetype = MOVETYPE_BOUNCE;
ball.wait = time + 1;
ball.touch = ka_TouchEvent;
- ball.think = ka_RespawnBall;
+ setthink(ball, ka_RespawnBall);
ball.nextthink = time + autocvar_g_keepawayball_respawntime;
ball.takedamage = DAMAGE_YES;
ball.effects &= ~EF_NODRAW;
if(time < game_starttime)
{
- this.think = ka_RespawnBall;
+ setthink(this, ka_RespawnBall);
this.touch = func_null;
this.nextthink = game_starttime;
}
else
- ka_RespawnBall();
+ ka_RespawnBall(this);
}
// Bot player logic
// ================
-void havocbot_goalrating_ball(float ratingscale, vector org)
-{SELFPARAM();
+void havocbot_goalrating_ball(entity this, float ratingscale, vector org)
+{
float t;
entity ball_owner;
ball_owner = ka_ball.owner;
- if (ball_owner == self)
+ if (ball_owner == this)
return;
// If ball is carried by player then hunt them down.
if (ball_owner)
{
- t = (self.health + self.armorvalue) / (ball_owner.health + ball_owner.armorvalue);
- navigation_routerating(ball_owner, t * ratingscale, 2000);
+ t = (this.health + this.armorvalue) / (ball_owner.health + ball_owner.armorvalue);
+ navigation_routerating(this, ball_owner, t * ratingscale, 2000);
}
else // Ball has been dropped so collect.
- navigation_routerating(ka_ball, ratingscale, 2000);
+ navigation_routerating(this, ka_ball, ratingscale, 2000);
}
-void havocbot_role_ka_carrier()
-{SELFPARAM();
- if (IS_DEAD(self))
+void havocbot_role_ka_carrier(entity this)
+{
+ if (IS_DEAD(this))
return;
- if (time > self.bot_strategytime)
+ if (time > this.bot_strategytime)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_items(10000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(20000, self.origin, 10000);
- //havocbot_goalrating_waypoints(1, self.origin, 1000);
- navigation_goalrating_end();
+ navigation_goalrating_start(this);
+ havocbot_goalrating_items(this, 10000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 20000, this.origin, 10000);
+ //havocbot_goalrating_waypoints(1, this.origin, 1000);
+ navigation_goalrating_end(this);
}
- if (!self.ballcarried)
+ if (!this.ballcarried)
{
- self.havocbot_role = havocbot_role_ka_collector;
- self.bot_strategytime = 0;
+ this.havocbot_role = havocbot_role_ka_collector;
+ this.bot_strategytime = 0;
}
}
-void havocbot_role_ka_collector()
-{SELFPARAM();
- if (IS_DEAD(self))
+void havocbot_role_ka_collector(entity this)
+{
+ if (IS_DEAD(this))
return;
- if (time > self.bot_strategytime)
+ if (time > this.bot_strategytime)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
- havocbot_goalrating_items(10000, self.origin, 10000);
- havocbot_goalrating_enemyplayers(1000, self.origin, 10000);
- havocbot_goalrating_ball(20000, self.origin);
- navigation_goalrating_end();
+ navigation_goalrating_start(this);
+ havocbot_goalrating_items(this, 10000, this.origin, 10000);
+ havocbot_goalrating_enemyplayers(this, 1000, this.origin, 10000);
+ havocbot_goalrating_ball(this, 20000, this.origin);
+ navigation_goalrating_end(this);
}
- if (self.ballcarried)
+ if (this.ballcarried)
{
- self.havocbot_role = havocbot_role_ka_carrier;
- self.bot_strategytime = 0;
+ this.havocbot_role = havocbot_role_ka_carrier;
+ this.bot_strategytime = 0;
}
}
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_keyhunt.qh"
#ifndef GAMEMODE_KEYHUNT_H
#define GAMEMODE_KEYHUNT_H
.entity kh_next;
float kh_Key_AllOwnedByWhichTeam();
-typedef void() kh_Think_t;
+USING(kh_Think_t, void());
void kh_StartRound();
void kh_Controller_SetThink(float t, kh_Think_t func);
if(vlen(key.owner.origin - p) > autocvar_g_balance_keyhunt_maxdist)
goto not_winning;
kh_WinnerTeam(self.team);
-:not_winning
+LABEL(not_winning)
}
if(kh_interferemsg_time && time > kh_interferemsg_time)
// legacy bot role
-void() havocbot_role_kh_carrier;
-void() havocbot_role_kh_defense;
-void() havocbot_role_kh_offense;
-void() havocbot_role_kh_freelancer;
+void(entity this) havocbot_role_kh_carrier;
+void(entity this) havocbot_role_kh_defense;
+void(entity this) havocbot_role_kh_offense;
+void(entity this) havocbot_role_kh_freelancer;
-void havocbot_goalrating_kh(float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
-{SELFPARAM();
+void havocbot_goalrating_kh(entity this, float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
+{
entity head;
for (head = kh_worldkeylist; head; head = head.kh_worldkeynext)
{
- if(head.owner == self)
+ if(head.owner == this)
continue;
if(!kh_tracking_enabled)
{
// if it's carried by our team we know about it
// otherwise we have to see it to know about it
- if(!head.owner || head.team != self.team)
+ if(!head.owner || head.team != this.team)
{
- traceline(self.origin + self.view_ofs, head.origin, MOVE_NOMONSTERS, self);
+ traceline(this.origin + this.view_ofs, head.origin, MOVE_NOMONSTERS, this);
if (trace_fraction < 1 && trace_ent != head)
continue; // skip what I can't see
}
}
if(!head.owner)
- navigation_routerating(head, ratingscale_dropped * BOT_PICKUP_RATING_HIGH, 100000);
- else if(head.team == self.team)
- navigation_routerating(head.owner, ratingscale_team * BOT_PICKUP_RATING_HIGH, 100000);
+ navigation_routerating(this, head, ratingscale_dropped * BOT_PICKUP_RATING_HIGH, 100000);
+ else if(head.team == this.team)
+ navigation_routerating(this, head.owner, ratingscale_team * BOT_PICKUP_RATING_HIGH, 100000);
else
- navigation_routerating(head.owner, ratingscale_enemy * BOT_PICKUP_RATING_HIGH, 100000);
+ navigation_routerating(this, head.owner, ratingscale_enemy * BOT_PICKUP_RATING_HIGH, 100000);
}
- havocbot_goalrating_items(1, self.origin, 10000);
+ havocbot_goalrating_items(this, 1, this.origin, 10000);
}
-void havocbot_role_kh_carrier()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_kh_carrier(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (!(self.kh_next))
+ if (!(this.kh_next))
{
LOG_TRACE("changing role to freelancer\n");
- self.havocbot_role = havocbot_role_kh_freelancer;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_kh_freelancer;
+ this.havocbot_role_timeout = 0;
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
- if(kh_Key_AllOwnedByWhichTeam() == self.team)
- havocbot_goalrating_kh(10, 0.1, 0.1); // bring home
+ if(kh_Key_AllOwnedByWhichTeam() == this.team)
+ havocbot_goalrating_kh(this, 10, 0.1, 0.1); // bring home
else
- havocbot_goalrating_kh(4, 4, 1); // play defensively
+ havocbot_goalrating_kh(this, 4, 4, 1); // play defensively
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_kh_defense()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_kh_defense(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (self.kh_next)
+ if (this.kh_next)
{
LOG_TRACE("changing role to carrier\n");
- self.havocbot_role = havocbot_role_kh_carrier;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_kh_carrier;
+ this.havocbot_role_timeout = 0;
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + random() * 10 + 20;
- if (time > self.havocbot_role_timeout)
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + random() * 10 + 20;
+ if (time > this.havocbot_role_timeout)
{
LOG_TRACE("changing role to freelancer\n");
- self.havocbot_role = havocbot_role_kh_freelancer;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_kh_freelancer;
+ this.havocbot_role_timeout = 0;
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float key_owner_team;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
key_owner_team = kh_Key_AllOwnedByWhichTeam();
- if(key_owner_team == self.team)
- havocbot_goalrating_kh(10, 0.1, 0.1); // defend key carriers
+ if(key_owner_team == this.team)
+ havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend key carriers
else if(key_owner_team == -1)
- havocbot_goalrating_kh(4, 1, 0.1); // play defensively
+ havocbot_goalrating_kh(this, 4, 1, 0.1); // play defensively
else
- havocbot_goalrating_kh(0.1, 0.1, 10); // ATTACK ANYWAY
+ havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK ANYWAY
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_kh_offense()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_kh_offense(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (self.kh_next)
+ if (this.kh_next)
{
LOG_TRACE("changing role to carrier\n");
- self.havocbot_role = havocbot_role_kh_carrier;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_kh_carrier;
+ this.havocbot_role_timeout = 0;
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + random() * 10 + 20;
- if (time > self.havocbot_role_timeout)
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + random() * 10 + 20;
+ if (time > this.havocbot_role_timeout)
{
LOG_TRACE("changing role to freelancer\n");
- self.havocbot_role = havocbot_role_kh_freelancer;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_kh_freelancer;
+ this.havocbot_role_timeout = 0;
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float key_owner_team;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
key_owner_team = kh_Key_AllOwnedByWhichTeam();
- if(key_owner_team == self.team)
- havocbot_goalrating_kh(10, 0.1, 0.1); // defend anyway
+ if(key_owner_team == this.team)
+ havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend anyway
else if(key_owner_team == -1)
- havocbot_goalrating_kh(0.1, 1, 4); // play offensively
+ havocbot_goalrating_kh(this, 0.1, 1, 4); // play offensively
else
- havocbot_goalrating_kh(0.1, 0.1, 10); // ATTACK! EMERGENCY!
+ havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK! EMERGENCY!
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
}
}
-void havocbot_role_kh_freelancer()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_kh_freelancer(entity this)
+{
+ if(IS_DEAD(this))
return;
- if (self.kh_next)
+ if (this.kh_next)
{
LOG_TRACE("changing role to carrier\n");
- self.havocbot_role = havocbot_role_kh_carrier;
- self.havocbot_role_timeout = 0;
+ this.havocbot_role = havocbot_role_kh_carrier;
+ this.havocbot_role_timeout = 0;
return;
}
- if (!self.havocbot_role_timeout)
- self.havocbot_role_timeout = time + random() * 10 + 10;
- if (time > self.havocbot_role_timeout)
+ if (!this.havocbot_role_timeout)
+ this.havocbot_role_timeout = time + random() * 10 + 10;
+ if (time > this.havocbot_role_timeout)
{
if (random() < 0.5)
{
LOG_TRACE("changing role to offense\n");
- self.havocbot_role = havocbot_role_kh_offense;
+ this.havocbot_role = havocbot_role_kh_offense;
}
else
{
LOG_TRACE("changing role to defense\n");
- self.havocbot_role = havocbot_role_kh_defense;
+ this.havocbot_role = havocbot_role_kh_defense;
}
- self.havocbot_role_timeout = 0;
+ this.havocbot_role_timeout = 0;
return;
}
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
float key_owner_team;
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
key_owner_team = kh_Key_AllOwnedByWhichTeam();
- if(key_owner_team == self.team)
- havocbot_goalrating_kh(10, 0.1, 0.1); // defend anyway
+ if(key_owner_team == this.team)
+ havocbot_goalrating_kh(this, 10, 0.1, 0.1); // defend anyway
else if(key_owner_team == -1)
- havocbot_goalrating_kh(1, 10, 4); // prefer dropped keys
+ havocbot_goalrating_kh(this, 1, 10, 4); // prefer dropped keys
else
- havocbot_goalrating_kh(0.1, 0.1, 10); // ATTACK ANYWAY
+ havocbot_goalrating_kh(this, 0.1, 0.1, 10); // ATTACK ANYWAY
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
}
}
MUTATOR_HOOKFUNCTION(kh, HavocBot_ChooseRole)
{
+ SELFPARAM();
if(IS_DEAD(self))
return true;
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_lms.qh"
#ifndef GAMEMODE_LMS_H
#define GAMEMODE_LMS_H
#ifdef IMPLEMENTATION
+#include <common/mutators/mutator/instagib/items.qc>
#include <server/campaign.qh>
#include <server/command/cmd.qh>
return bound(1, lms_lowest_lives, fl);
}
+void ClearWinners();
+
// LMS winning condition: game terminates if and only if there's at most one
// one player who's living lives. Top two scores being equal cancels the time
// limit.
// FIXME fix LMS scoring for new system
if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
{
- self.classname = STR_OBSERVER;
+ TRANSMUTE(Observer, self);
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_NOLIVES);
}
}
MUTATOR_HOOKFUNCTION(lms, ClientConnect)
{SELFPARAM();
- self.classname = STR_PLAYER;
- campaign_bots_may_start = 1;
+ TRANSMUTE(Player, self);
+ campaign_bots_may_start = true;
if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
{
MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
{SELFPARAM();
- if(self.deadflag == DEAD_DYING)
- self.deadflag = DEAD_RESPAWNING;
+ if(this.deadflag == DEAD_DYING)
+ this.deadflag = DEAD_RESPAWNING;
return false;
}
MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
{
+ SELFPARAM();
if(self.lms_spectate_warning)
{
// for the forfeit message...
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_race.qh"
+
#ifndef GAMEMODE_RACE_H
#define GAMEMODE_RACE_H
return 0;
}
-float race_teams;
-
-// scores
-const float ST_RACE_LAPS = 1;
-const float SP_RACE_LAPS = 4;
-const float SP_RACE_TIME = 5;
-const float SP_RACE_FASTEST = 6;
#endif
#ifdef IMPLEMENTATION
// legacy bot roles
.float race_checkpoint;
-void havocbot_role_race()
-{SELFPARAM();
- if(IS_DEAD(self))
+void havocbot_role_race(entity this)
+{
+ if(IS_DEAD(this))
return;
entity e;
- if (self.bot_strategytime < time)
+ if (this.bot_strategytime < time)
{
- self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
- navigation_goalrating_start();
+ this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+ navigation_goalrating_start(this);
for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; )
{
- if(e.cnt == self.race_checkpoint)
+ if(e.cnt == this.race_checkpoint)
{
- navigation_routerating(e, 1000000, 5000);
+ navigation_routerating(this, e, 1000000, 5000);
}
- else if(self.race_checkpoint == -1)
+ else if(this.race_checkpoint == -1)
{
- navigation_routerating(e, 1000000, 5000);
+ navigation_routerating(this, e, 1000000, 5000);
}
}
- navigation_goalrating_end();
+ navigation_goalrating_end(this);
}
}
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
+#include "gamemode_tdm.qh"
#ifndef GAMEMODE_TDM_H
#define GAMEMODE_TDM_H
int autocvar_g_tdm_point_limit;
int autocvar_g_tdm_point_leadlimit;
bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit();
+void tdm_DelayedInit(entity this);
REGISTER_MUTATOR(tdm, false)
{
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_tdm_team(this));
+ WITHSELF(this, spawnfunc_tdm_team(this));
}
-void tdm_DelayedInit()
+void tdm_DelayedInit(entity this)
{
// if no teams are found, spawn defaults
if(find(world, classname, "tdm_team") == world)
--- /dev/null
+#pragma once
+
+#include "../gamemode.qh"
--- /dev/null
+// generated file; do not modify
+#include "costs.qc"
+#include "debug.qc"
+#include "expandnode.qc"
+#include "main.qc"
+#include "movenode.qc"
+#include "path_waypoint.qc"
+#include "utility.qc"
+#include "costs.qh"
#include "pathlib.qh"
float pathlib_g_static(entity parent,vector to, float static_cost)
--- /dev/null
+#pragma once
+#include "debug.qh"
#include "pathlib.qh"
MODEL(SQUARE, "models/pathlib/square.md3");
--- /dev/null
+#pragma once
+#include "expandnode.qh"
#include "pathlib.qh"
#include "utility.qh"
--- /dev/null
+#pragma once
+#include "main.qh"
#include "pathlib.qh"
#include "utility.qh"
-#ifndef PATHLIB_MAIN_H
-#define PATHLIB_MAIN_H
+#pragma once
+
float buildpath_nodefilter_none(vector n,vector c,vector p);
entity path_build(entity next, vector where, entity prev, entity start);
-#endif
+#include "movenode.qh"
#include "pathlib.qh"
#include "utility.qh"
--- /dev/null
+#pragma once
+#include "path_waypoint.qh"
#include "../bot/waypoints.qh"
#include "pathlib.qh"
--- /dev/null
+#pragma once
-#ifndef PATHLIB_H
-#define PATHLIB_H
+#pragma once
.entity pathlib_list;
.entity path_next;
.entity path_prev;
#define inwater(point) (pointcontents(point) == CONTENT_WATER)
-#define medium spawnshieldtime
+.int medium;
const vector PLIB_FORWARD = '0 1 0';
//#define PLIB_BACK '0 -1 0'
var float buildpath_nodefilter(vector n,vector c,vector p);
var float pathlib_wpp_waypointcallback(entity wp, entity wp_prev);
-
-#endif
-#ifndef PATHLIB_UTILITY
-#define PATHLIB_UTILITY
+#pragma once
+
float fsnap(float val,float fsize);
entity pathlib_nodeatpoint(vector where);
float tile_check_plus2(vector where);
-#endif
+#include "playerdemo.qh"
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
}
void playerdemo_write()
{SELFPARAM();
- if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
+ if(this.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
return;
- fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
+ fputs(this.playerdemo_fh, strcat(ftos(time - this.playerdemo_starttime), "\n"));
PLAYERDEMO_FIELDS(playerdemo_write_)
}
void playerdemo_read_originvector(.vector f, string name)
PLAYERDEMO_FIELDS(playerdemo_read_)
{
time = this.playerdemo_time;
- WITH(entity, self, this, PlayerPreThink());
+ WITHSELF(this, PlayerPreThink());
// not running physics though... this is just so we can run weapon stuff
- WITH(entity, self, this, PlayerPostThink());
+ WITHSELF(this, PlayerPostThink());
}
this.playerdemo_time = stof(fgets(this.playerdemo_fh));
if(this.playerdemo_time == 0)
-#ifndef PLAYERDEMO_H
-#define PLAYERDEMO_H
+#pragma once
void playerdemo_init(entity this);
void playerdemo_shutdown();
void playerdemo_open_read(string f);
void playerdemo_open_write(string f);
-#endif
-#ifndef PORTALS_H
-#define PORTALS_H
+#pragma once
.float portal_id;
.entity portal_in, portal_out;
vector Portal_ApplyTransformToPlayerAngle(vector transform, vector vangle);
void Portal_ClearAll_PortalsOnly(entity own);
-#endif
+++ /dev/null
-
-/* file generated by qcc, do not modify */
-
-typedef struct
-{ int pad[28];
- int self;
- int other;
- int world;
- float time;
- float frametime;
- float force_retouch;
- string_t mapname;
- float deathmatch;
- float coop;
- float teamplay;
- float serverflags;
- float total_secrets;
- float total_monsters;
- float found_secrets;
- float killed_monsters;
- float parm1;
- float parm2;
- float parm3;
- float parm4;
- float parm5;
- float parm6;
- float parm7;
- float parm8;
- float parm9;
- float parm10;
- float parm11;
- float parm12;
- float parm13;
- float parm14;
- float parm15;
- float parm16;
- vec3_t v_forward;
- vec3_t v_up;
- vec3_t v_right;
- float trace_allsolid;
- float trace_startsolid;
- float trace_fraction;
- vec3_t trace_endpos;
- vec3_t trace_plane_normal;
- float trace_plane_dist;
- int trace_ent;
- float trace_inopen;
- float trace_inwater;
- int msg_entity;
- func_t main;
- func_t StartFrame;
- func_t PlayerPreThink;
- func_t PlayerPostThink;
- func_t ClientKill;
- func_t ClientConnect;
- func_t PutClientInServer;
- func_t ClientDisconnect;
- func_t SetNewParms;
- func_t SetChangeParms;
-} globalvars_t;
-
-typedef struct
-{
- float modelindex;
- vec3_t absmin;
- vec3_t absmax;
- float ltime;
- float movetype;
- float solid;
- vec3_t origin;
- vec3_t oldorigin;
- vec3_t velocity;
- vec3_t angles;
- vec3_t avelocity;
- vec3_t punchangle;
- string_t classname;
- string_t model;
- float frame;
- float skin;
- float effects;
- vec3_t mins;
- vec3_t maxs;
- vec3_t size;
- func_t touch;
- func_t use;
- func_t think;
- func_t blocked;
- float nextthink;
- int groundentity;
- float health;
- float frags;
- float weapon;
- string_t weaponmodel;
- float weaponframe;
- float currentammo;
- float ammo_shells;
- float ammo_nails;
- float ammo_rockets;
- float ammo_cells;
- float items;
- float takedamage;
- int chain;
- float deadflag;
- vec3_t view_ofs;
- float button0;
- float button1;
- float button2;
- float impulse;
- float fixangle;
- vec3_t v_angle;
- float idealpitch;
- string_t netname;
- int enemy;
- float flags;
- float colormap;
- float team;
- float max_health;
- float teleport_time;
- float armortype;
- float armorvalue;
- float waterlevel;
- float watertype;
- float ideal_yaw;
- float yaw_speed;
- int aiment;
- int goalentity;
- float spawnflags;
- string_t target;
- string_t targetname;
- float dmg_take;
- float dmg_save;
- int dmg_inflictor;
- int owner;
- vec3_t movedir;
- string_t message;
- float sounds;
- string_t noise;
- string_t noise1;
- string_t noise2;
- string_t noise3;
-} entvars_t;
-
-#define PROGHEADER_CRC 5927
-#include "../lib/_all.inc"
-#include "_all.qh"
-
-#include "../common/effects/qc/all.qc"
-
-#include "anticheat.qc"
-#include "antilag.qc"
-#include "campaign.qc"
-#include "cheats.qc"
-#include "cl_client.qc"
-#include "cl_impulse.qc"
-#include "cl_player.qc"
-#include "g_damage.qc"
-#include "g_hook.qc"
-// #include "g_lights.qc" // TODO: was never used
-#include "g_models.qc"
-#include "g_subs.qc"
-#include "g_world.qc"
-#include "ipban.qc"
-#include "item_key.qc"
-#include "mapvoting.qc"
-#include "miscfunctions.qc"
-#include "playerdemo.qc"
-#include "portals.qc"
-#include "race.qc"
-#include "round_handler.qc"
-#include "scores.qc"
-#include "scores_rules.qc"
-#include "spawnpoints.qc"
-#include "steerlib.qc"
-#include "sv_main.qc"
-#include "teamplay.qc"
-#include "t_halflife.qc"
-#include "t_quake3.qc"
-#include "t_quake.qc"
-
-#include "bot/_all.inc"
+#ifndef DEBUGPATHING
+ #define DEBUGPATHING 0
+#endif
-#include "command/all.qc"
+#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"
-#include "weapons/accuracy.qc"
-#include "weapons/common.qc"
-#include "weapons/csqcprojectile.qc" // TODO
-#include "weapons/hitplot.qc"
-#include "weapons/selection.qc"
-#include "weapons/spawning.qc"
-#include "weapons/throwing.qc"
-#include "weapons/tracing.qc"
-#include "weapons/weaponstats.qc"
-#include "weapons/weaponsystem.qc"
-
-#include "../common/_all.inc"
-#include "mutators/all.qc"
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
-#include "../lib/csqcmodel/sv_model.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"
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
#if BUILD_MOD
#include "../../mod/server/progs.inc"
return false;
}
-float have_verified;
-void trigger_race_checkpoint_verify()
-{SELFPARAM();
- entity cp;
- float i, p;
- float qual;
-
- if(have_verified)
- return;
- have_verified = 1;
+void trigger_race_checkpoint_verify(entity this)
+{
+ static bool have_verified;
+ if (have_verified) return;
+ have_verified = true;
- qual = g_race_qualifying;
+ bool qual = g_race_qualifying;
- setself(spawn());
- self.classname = STR_PLAYER;
+ int pl_race_checkpoint = 0;
+ int pl_race_place = 0;
- if(g_race)
- {
- for(i = 0; i <= race_highest_checkpoint; ++i)
- {
- self.race_checkpoint = race_NextCheckpoint(i);
+ if (g_race) {
+ for (int i = 0; i <= race_highest_checkpoint; ++i) {
+ pl_race_checkpoint = race_NextCheckpoint(i);
// race only (middle of the race)
- g_race_qualifying = 0;
- self.race_place = 0;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out"));
+ g_race_qualifying = false;
+ pl_race_place = 0;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));
+ }
- if(i == 0)
- {
+ if (i == 0) {
// qualifying only
g_race_qualifying = 1;
- self.race_place = race_lowest_place_spawn;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
+ pl_race_place = race_lowest_place_spawn;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+ }
// race only (initial spawn)
g_race_qualifying = 0;
- for(p = 1; p <= race_highest_place_spawn; ++p)
- {
- self.race_place = p;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out"));
+ for (int p = 1; p <= race_highest_place_spawn; ++p) {
+ pl_race_place = p;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for initially spawning in race) - bailing out"));
+ }
}
}
}
- }
- else if(!defrag_ents)
- {
+ } else if (!defrag_ents) {
// qualifying only
- self.race_checkpoint = race_NextCheckpoint(0);
+ pl_race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
- self.race_place = race_lowest_place_spawn;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false))
- error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
- }
- else
- {
- self.race_checkpoint = race_NextCheckpoint(0);
+ pl_race_place = race_lowest_place_spawn;
+ if (!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, false)) {
+ error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
+ }
+ } else {
+ pl_race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
- self.race_place = 0; // there's only one spawn on defrag maps
+ pl_race_place = 0; // there's only one spawn on defrag maps
// check if a defragcp file already exists, then read it and apply the checkpoint order
float fh;
string l;
defragcpexists = fh = fopen(strcat("maps/", GetMapname(), ".defragcp"), FILE_READ);
- if(fh >= 0)
- {
- while((l = fgets(fh)))
- {
+ if (fh >= 0) {
+ while ((l = fgets(fh))) {
len = tokenize_console(l);
- if(len != 2)
- {
+ if (len != 2) {
defragcpexists = -1; // something's wrong in the defrag cp file, set defragcpexists to -1 so that it will be rewritten when someone finishes
continue;
}
- for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
- if(argv(0) == cp.targetname)
+ for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+ if (argv(0) == cp.targetname) {
cp.race_checkpoint = stof(argv(1));
+ }
+ }
}
fclose(fh);
}
g_race_qualifying = qual;
- if(race_timed_checkpoint)
- {
- if(defrag_ents)
- {
- for(cp = world; (cp = find(cp, classname, "target_startTimer"));)
+ if (race_timed_checkpoint) {
+ if (defrag_ents) {
+ for (entity cp = world; (cp = find(cp, classname, "target_startTimer"));) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
- for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+ }
+ for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
-
- for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
- {
- if(cp.race_checkpoint == -2) // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
+ }
+ for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+ if (cp.race_checkpoint == -2) { // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes
defragcpexists = -1;
+ }
}
-
- if(defragcpexists != -1)
- {
+ if (defragcpexists != -1) {
float largest_cp_id = 0;
- for(cp = world; (cp = find(cp, classname, "target_checkpoint"));)
- if(cp.race_checkpoint > largest_cp_id)
+ for (entity cp = world; (cp = find(cp, classname, "target_checkpoint"));) {
+ if (cp.race_checkpoint > largest_cp_id) {
largest_cp_id = cp.race_checkpoint;
- for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+ }
+ }
+ for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
cp.race_checkpoint = largest_cp_id + 1; // finish line
+ }
race_highest_checkpoint = largest_cp_id + 1;
race_timed_checkpoint = largest_cp_id + 1;
- }
- else
- {
- for(cp = world; (cp = find(cp, classname, "target_stopTimer"));)
+ } else {
+ for (entity cp = world; (cp = find(cp, classname, "target_stopTimer"));) {
cp.race_checkpoint = 255; // finish line
+ }
race_highest_checkpoint = 255;
race_timed_checkpoint = 255;
}
- }
- else
- {
- for(cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); )
- if(cp.sprite)
- {
- if(cp.race_checkpoint == 0)
+ } else {
+ for (entity cp = world; (cp = find(cp, classname, "trigger_race_checkpoint")); ) {
+ if (cp.sprite) {
+ if (cp.race_checkpoint == 0) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null);
- else if(cp.race_checkpoint == race_timed_checkpoint)
+ } else if (cp.race_checkpoint == race_timed_checkpoint) {
WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null);
+ }
}
+ }
}
}
- if(defrag_ents)
- {
- entity trigger, targ;
- for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
- for(targ = world; (targ = find(targ, targetname, trigger.target)); )
- if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer")
- {
+ if (defrag_ents) {
+ for (entity trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) {
+ for (entity targ = world; (targ = find(targ, targetname, trigger.target)); ) {
+ if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") {
trigger.wait = 0;
trigger.delay = 0;
targ.wait = 0;
//setorigin(targ, trigger.origin);
//remove(trigger);
}
+ }
+ }
}
- remove(self);
- setself(this);
}
vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current)
FOREACH_CLIENT(true, LAMBDA(
float p = it.race_place;
- WITH(entity, self, it, race_PreparePlayer());
+ WITHSELF(it, race_PreparePlayer());
it.race_place = p;
));
}
-#ifndef RACE_H
-#define RACE_H
+#pragma once
+
+float race_teams;
+
+// scores
+const float ST_RACE_LAPS = 1;
+const float SP_RACE_LAPS = 4;
+const float SP_RACE_TIME = 5;
+const float SP_RACE_FASTEST = 6;
bool g_race_qualifying;
void race_RetractPlayer();
void race_InitSpectator();
-
-#endif
-#ifndef ROUND_HANDLER_H
-#define ROUND_HANDLER_H
+#pragma once
entity round_handler;
.float delay; // stores delay from round end to countdown start
#define round_handler_CountdownRunning() (!round_handler.wait && round_handler.cnt)
#define round_handler_IsRoundStarted() (!round_handler.wait && !round_handler.cnt)
#define round_handler_GetEndTime() (round_handler.round_endtime)
-
-#endif
void WinningConditionHelper()
{
+ SELFPARAM();
float c;
string s;
float fullstatus;
-#ifndef SCORES_H
-#define SCORES_H
+#pragma once
-#include "../common/constants.qh"
+#include <common/constants.qh>
entity scores_initialized; // non-world when scores labels/rules have been set
.float scores[MAX_SCORE];
* nospectators: exclude spectators
*/
entity PlayerScore_Sort(.float field, float teams, float strict, float nospectators);
-#endif
-#ifndef SCORES_RULES_H
-#define SCORES_RULES_H
+#pragma once
void ScoreRules_basics(float teams, float sprio, float stprio, float score_enabled);
void ScoreRules_basics_end();
void ScoreRules_generic();
-
-#endif
if(autocvar_g_spawn_alloweffects)
{
- WriteByte(MSG_ENTITY, etof(self.owner));
- WriteCoord(MSG_ENTITY, self.owner.origin.x);
- WriteCoord(MSG_ENTITY, self.owner.origin.y);
- WriteCoord(MSG_ENTITY, self.owner.origin.z);
+ WriteByte(MSG_ENTITY, etof(this.owner));
+ WriteCoord(MSG_ENTITY, this.owner.origin.x);
+ WriteCoord(MSG_ENTITY, this.owner.origin.y);
+ WriteCoord(MSG_ENTITY, this.owner.origin.z);
send = true;
}
- else if((to == self.owner) || (IS_SPEC(to) && (to.enemy == self.owner)) )
+ else if((to == this.owner) || (IS_SPEC(to) && (to.enemy == this.owner)) )
{
WriteByte(MSG_ENTITY, 0);
send = true;
.vector spawnpoint_prevorigin;
void spawnpoint_think()
{
- self.nextthink = time + 0.1;
- if(self.origin != self.spawnpoint_prevorigin)
+ SELFPARAM();
+ this.nextthink = time + 0.1;
+ if(this.origin != this.spawnpoint_prevorigin)
{
- self.spawnpoint_prevorigin = self.origin;
- self.SendFlags |= 1;
+ this.spawnpoint_prevorigin = this.origin;
+ this.SendFlags |= 1;
}
}
++found;
if(ent.spawn_evalfunc)
{
- WITH(entity, self, ent, {
- spawn_score = ent.spawn_evalfunc(this, spot, spawn_score);
- });
+ WITHSELF(ent, spawn_score = ent.spawn_evalfunc(this, spot, spawn_score));
if(spawn_score.x < 0)
return spawn_score;
}
-#ifndef SPAWNPOINTS_H
-#define SPAWNPOINTS_H
+#pragma once
.vector spawnpoint_score;
float spawnpoint_nag;
entity SelectSpawnPoint (float anypoint);
spawnfunc(info_player_deathmatch);
void spawnpoint_use();
-#endif
+#include "steerlib.qh"
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
-#ifndef STEERLIB_H
-#define STEERLIB_H
+#pragma once
.vector steerto;
vector steerlib_arrive(vector point,float maximal_distance);
vector steerlib_attract2(entity this, vector point, float min_influense,float max_distance,float max_influense);
vector steerlib_pull(vector point);
-
-#endif
+#include "sv_main.qh"
#include "anticheat.qh"
#include "g_hook.qh"
void CreatureFrame_All()
{
- FOREACH_ENTITY_FLOAT(damagedbycontents, true, LAMBDA(
- if(it.movetype == MOVETYPE_NOCLIP) continue;
+ FOREACH_ENTITY_FLOAT(damagedbycontents, true, {
+ if (it.movetype == MOVETYPE_NOCLIP) continue;
CreatureFrame_Liquids(it);
CreatureFrame_FallDamage(it);
it.oldvelocity = it.velocity;
- ));
+ });
}
void Pause_TryPause(bool ispaused)
bool autocvar_sv_autopause = true;
float RedirectionThink();
+void PM_Main(Client this);
void StartFrame()
{
- SELFPARAM();
+ // TODO: if move is more than 50ms, split it into two moves (this matches QWSV behavior and the client prediction)
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PM_Main(it));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPreThink()));
+
execute_next_frame();
if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
}
#endif
- FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, LAMBDA(CSQCProjectile_Check(it)));
+ FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, CSQCProjectile_Check(it));
- if(RedirectionThink())
- return;
+ if (RedirectionThink()) return;
UncustomizeEntitiesRun();
InitializeEntitiesRun();
WarpZone_StartFrame();
sys_frametime = autocvar_sys_ticrate * autocvar_slowmo;
- if(sys_frametime <= 0)
- sys_frametime = 1.0 / 60.0; // somewhat safe fallback
+ if (sys_frametime <= 0) sys_frametime = 1.0 / 60.0; // somewhat safe fallback
if (timeout_status == TIMEOUT_LEADTIME) // just before the timeout (when timeout_status will be TIMEOUT_ACTIVE)
orig_slowmo = autocvar_slowmo; // slowmo will be restored after the timeout
// detect when the pre-game countdown (if any) has ended and the game has started
game_delay = (time < game_starttime);
- if(autocvar_sv_eventlog && game_delay_last && !game_delay)
+ if (autocvar_sv_eventlog && game_delay_last && !game_delay)
GameLogEcho(":startdelay_ended");
game_delay_last = game_delay;
CreatureFrame_All();
CheckRules_World();
- // if in warmup stage and limit for warmup is hit start match
- if(warmup_stage)
- if(!gameover)
- if((g_warmup_limit > 0 && time >= g_warmup_limit)
- || (g_warmup_limit == 0 && autocvar_timelimit != 0 && time >= autocvar_timelimit * 60))
- {
+ if (warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit) {
ReadyRestart();
return;
}
anticheat_startframe();
MUTATOR_CALLHOOK(SV_StartFrame);
- FOREACH_CLIENT(true, LAMBDA(GlobalStats_update(it)));
+ FOREACH_CLIENT(true, GlobalStats_update(it));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPostThink()));
}
.vector originjitter;
}
}
inv = !inv;
-:cvar_fail
+LABEL(cvar_fail)
// now inv is 1 if we want to keep the item, and 0 if we want to get rid of it
if (!inv)
{
--- /dev/null
+#pragma once
-#ifndef SERVER_SYS_POST_H
-#define SERVER_SYS_POST_H
+#pragma once
#undef objerror
#undef droptofloor
#undef IT_QUAD
#pragma noref 0
-
-#endif
-#ifndef SERVER_SYS_PRE_H
-#define SERVER_SYS_PRE_H
+#pragma once
#define objerror builtin_objerror
#define droptofloor builtin_droptofloor
#define IT_QUAD _IT_QUAD /* BIT(22) */
#pragma noref 1
-
-#endif
+#include "t_halflife.qh"
.float roomtype;
.float radius;
.float pitch;
--- /dev/null
+#pragma once
+#include "t_quake.qh"
#include "../common/weapons/all.qh"
--- /dev/null
+#pragma once
+#include "t_quake3.qh"
#include "../common/weapons/all.qh"
.float delay;
// weapon remove ent from df
-void target_init_verify()
+void target_init_verify(entity this)
{
entity trigger, targ;
for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
}
// weapon give ent from defrag
-void target_give_init()
-{SELFPARAM();
+void target_give_init(entity this)
+{
entity targ;
for (targ = world; (targ = find(targ, targetname, self.target)); ) {
if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
--- /dev/null
+#pragma once
GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
}
-void default_delayedinit()
+void default_delayedinit(entity this)
{
if(!scores_initialized)
ScoreRules_generic();
return RandomSelection_chosen_float;
}
-float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
+int JoinBestTeam(entity pl, bool only_return_best, bool forcebestteam)
{SELFPARAM();
float smallest, selectedteam;
-#ifndef TEAMPLAY_H
-#define TEAMPLAY_H
+#pragma once
string cache_mutatormsg;
string cache_lastmutatormsg;
void LogTeamchange(float player_id, float team_number, float type);
-void default_delayedinit();
+void default_delayedinit(entity this);
void ActivateTeamplay();
// NOTE: Assumes CheckAllowedTeams has already been called!
float FindSmallestTeam(entity pl, float ignore_pl);
-float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
+int JoinBestTeam(entity pl, bool only_return_best, bool forcebestteam);
//void() ctf_playerchanged;
void SV_ChangeTeam(float _color);
void ShufflePlayerOutOfTeam (float source_team);
-#endif
--- /dev/null
+#include "tests.qh"
+
+void test_weapons_hurt(entity this)
+{
+ EXPECT_NE(100, this.health);
+ remove(this.enemy);
+ remove(this);
+}
+
+TEST(Weapons, Hurt)
+{
+ entity it;
+
+ noref Client a = it = NEW(Client, "A");
+ WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_1));
+ it.origin = '-100 0 0';
+ it.angles = '0 0 0';
+
+ noref Client b = it = NEW(Client, "B");
+ WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_2));
+ it.origin = '100 0 0';
+ it.angles = '0 180 0';
+
+ it = a;
+ PHYS_INPUT_BUTTON_ATCK(it) = true;
+ it.items |= IT_UNLIMITED_AMMO;
+ Weapon wep = WEP_VORTEX;
+ W_GiveWeapon(it, wep.m_id);
+ W_SwitchWeapon_Force(it, wep);
+
+ it = b;
+ PHYS_INPUT_BUTTON_JUMP(it) = true;
+ it.enemy = a;
+
+ defer(it, wep.switchdelay_raise + 0.1, test_weapons_hurt);
+
+ SUCCEED();
+}
+
+TEST(Vehicles, Spawn)
+{
+ entity it;
+
+ noref Client bot = it = NEW(Client, "Rider");
+ Client_Add(it, NUM_TEAM_1);
+ it.origin = '0 0 100';
+
+ noref entity v = it = new(vehicle);
+ Vehicle veh = VEH_BUMBLEBEE;
+ it.active = ACTIVE_NOT;
+ vehicle_initialize(it, veh, false);
+ it.nextthink = time;
+
+ SUCCEED();
+}
--- /dev/null
+#pragma once
+
+#include "autocvars.qh"
+#include "cl_client.qh"
+#include "command/all.qh"
+#include "weapons/common.qh"
+#include "weapons/selection.qh"
+#include <common/items/item.qh>
+#include <common/physics/player.qh>
+#include <common/weapons/all.qh>
+#include <common/vehicles/all.qh>
--- /dev/null
+// generated file; do not modify
+#include "accuracy.qc"
+#include "common.qc"
+#include "csqcprojectile.qc"
+#include "hitplot.qc"
+#include "selection.qc"
+#include "spawning.qc"
+#include "throwing.qc"
+#include "tracing.qc"
+#include "weaponstats.qc"
+#include "weaponsystem.qc"
-#ifndef ACCURACY_H
-#define ACCURACY_H
+#pragma once
.bool cvar_cl_accuracy_data_share;
REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
// helper
bool accuracy_isgooddamage(entity attacker, entity targ);
bool accuracy_canbegooddamage(entity attacker);
-#endif
#include <common/weapons/all.qh>
#include <common/items/all.qc>
-void W_GiveWeapon (entity e, float wep)
-{SELFPARAM();
-
- if (!wep)
- return;
+void W_GiveWeapon(entity e, int wep)
+{
+ if (!wep) return;
e.weapons |= WepSet_FromWeapon(Weapons_from(wep));
- setself(e);
-
- if(IS_PLAYER(other))
- { Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_WEAPON_GOT, wep); }
-
- setself(this);
+ if (IS_PLAYER(e)) {
+ Send_Notification(NOTIF_ONE, e, MSG_MULTI, ITEM_WEAPON_GOT, wep);
+ }
}
void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
-#ifndef WEAPONS_COMMON_H
-#define WEAPONS_COMMON_H
+#pragma once
void W_GiveWeapon (entity e, float wep);
.float prevstrengthsound;
void W_PlayStrengthSound(entity player);
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception);
void W_PrepareExplosionByDamage(entity attacker, void() explode);
-#endif
-#ifndef CSQCPROJECTILE_H
-#define CSQCPROJECTILE_H
+#pragma once
.float csqcprojectile_clientanimate;
void UpdateCSQCProjectile(entity e);
void UpdateCSQCProjectileAfterTeleport(entity e);
void CSQCProjectile_Check(entity e);
-#endif
#include "../antilag.qh"
#include "../g_subs.qh"
#include <common/weapons/all.qh>
+#include <common/state.qh>
vector W_HitPlotUnnormalizedUntransform(vector screenforward, vector screenright, vector screenup, vector v)
{
traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
{
- antilag_takeback(trace_ent, time - lag);
+ entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
+ antilag_takeback(trace_ent, store, time - lag);
hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
- antilag_restore(trace_ent);
+ antilag_restore(trace_ent, store);
fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(PS(player).m_switchweapon.m_id), "\n"));
//print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
}
-#ifndef HITPLOT_H
-#define HITPLOT_H
+#pragma once
.float hitplotfh;
void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright, vector screenup);
void W_HitPlotOpen(entity player);
void W_HitPlotClose(entity player);
-#endif
#include <common/util.qh>
#include <common/items/item.qh>
#include <common/weapons/all.qh>
+#include <common/state.qh>
#include <common/mutators/mutator/waypoints/waypointsprites.qh>
// switch between weapons
bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain)
{
+ SELFPARAM();
float f = 0;
if (time < cl.hasweapon_complain_spam)
}
else
{
- WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
+ WITHSELF(cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
// always allow selecting the Mine Layer if we placed mines, so that we can detonate them
if(wpn == WEP_MINE_LAYER)
return 0;
}
-void W_SwitchWeapon_Force(entity e, Weapon wep)
+void W_SwitchWeapon_Force(Player this, Weapon wep)
{
- e.cnt = PS(e).m_switchweapon.m_id;
- PS(e).m_switchweapon = wep;
- e.selectweapon = wep.m_id;
+ TC(Player, this); TC(Weapon, wep);
+ this.cnt = PS(this).m_switchweapon.m_id;
+ PS(this).m_switchweapon = wep;
+ this.selectweapon = wep.m_id;
}
// perform weapon to attack (weaponstate and attack_finished check is here)
-#ifndef SELECTION_H
-#define SELECTION_H
+#pragma once
// switch between weapons
void Send_WeaponComplain(entity e, float wpn, float type);
#define w_getbestweapon(ent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true))
-void W_SwitchWeapon_Force(entity e, Weapon w);
+void W_SwitchWeapon_Force(Player this, Weapon w);
// perform weapon to attack (weaponstate and attack_finished check is here)
void W_SwitchToOtherWeapon(entity pl);
// previously used if exists and has ammo, (second) best otherwise
void W_LastWeapon(entity this);
-#endif
-#ifndef SPAWNING_H
-#define SPAWNING_H
+#pragma once
string W_Apply_Weaponreplace(string in);
void weapon_defaultspawnfunc(entity this, Weapon e);
-#endif
#include <common/triggers/subs.qh>
#include <common/util.qh>
#include <common/weapons/all.qh>
+#include <common/state.qh>
void thrown_wep_think()
{SELFPARAM();
-#ifndef THROWING_H
-#define THROWING_H
+#pragma once
.float savenextthink;
void thrown_wep_think();
void W_ThrowWeapon(vector velo, vector delta, float doreduce);
void SpawnThrownWeapon(entity this, vector org, float w);
-#endif
#include <common/util.qh>
#include <common/weapons/all.qh>
+#include <common/state.qh>
#include <lib/warpzone/common.qh>
// this function calculates w_shotorg and w_shotdir based on the weapon model
// offset, trueaim and antilag, and won't put w_shotorg inside a wall.
// make sure you call makevectors first (FIXME?)
-void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range)
+void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range)
{
+ TC(Sound, snd);
float nudge = 1; // added to traceline target and subtracted from result TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
float oldsolid;
vector vecs, dv;
if (!autocvar_g_norecoil)
ent.punchangle_x = recoil * -1;
- if (snd != "")
- {
- _sound (ent, chan, snd, VOL_BASE, ATTN_NORM);
+ if (snd != SND_Null) {
+ sound (ent, chan, snd, VOL_BASE, ATTN_NORM);
W_PlayStrengthSound(ent);
}
fireBullet_last_hit = world;
}
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
-{SELFPARAM();
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
+{
vector end;
dir = normalize(dir + randomvec() * spread);
else
fireBullet_trace_callback_eff = EFFECT_BULLET;
- float lag = ANTILAG_LATENCY(self);
+ float lag = ANTILAG_LATENCY(this);
if(lag < 0.001)
lag = 0;
- if (!IS_REAL_CLIENT(self))
+ if (!IS_REAL_CLIENT(this))
lag = 0;
- if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
+ if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
lag = 0; // only do hitscan, but no antilag
if(lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(antilag_takeback(it, time - lag)));
- FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
- if(it != self)
- antilag_takeback(it, time - lag);
- ));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
+ FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+ if (it != this)
+ antilag_takeback(it, it, time - lag);
+ });
}
// change shooter to SOLID_BBOX so the shot can hit corpses
- int oldsolid = self.dphitcontentsmask;
- if(self)
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ int oldsolid = this.dphitcontentsmask;
+ if(this)
+ this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- WarpZone_trace_forent = self;
+ WarpZone_trace_forent = this;
for (;;)
{
is_weapclip = true;
if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
- Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
+ Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, this);
if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit) // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
{
fireBullet_last_hit = hit;
yoda = 0;
- MUTATOR_CALLHOOK(FireBullet_Hit, self, hit, start, end, damage);
+ MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
damage = frag_damage;
- float g = accuracy_isgooddamage(self, hit);
- Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+ float g = accuracy_isgooddamage(this, hit);
+ Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
// calculate hits for ballistic weapons
if(g)
{
// do not exceed 100%
float added_damage = min(damage - total_damage, damage * solid_penetration_left);
total_damage += damage * solid_penetration_left;
- accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
+ accuracy_add(this, PS(this).m_weapon.m_id, 0, added_damage);
}
}
// Only show effect when going through a player (invisible otherwise)
if (hit && (hit.solid != SOLID_BSP))
if(vdist(trace_endpos - start, >, 4))
- trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
+ trailparticles(this, fireBullet_trace_callback_eff, start, trace_endpos);
start = trace_endpos;
if(hit.solid == SOLID_BSP)
- Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
+ Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, this);
}
if(lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(antilag_restore(it)));
- FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, LAMBDA(
- if(it != self)
- antilag_restore(it);
- ));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
+ FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
+ if (it != this)
+ antilag_restore(it, it);
+ });
}
// restore shooter solid type
- if(self)
- self.dphitcontentsmask = oldsolid;
+ if(this)
+ this.dphitcontentsmask = oldsolid;
}
-#ifndef TRACING_H
-#define TRACING_H
+#pragma once
vector w_shotorg;
vector w_shotdir;
// this function calculates w_shotorg and w_shotdir based on the weapon model
// offset, trueaim and antilag, and won't put w_shotorg inside a wall.
// make sure you call makevectors first (FIXME?)
-void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, string snd, float chan, float maxdamage, float range);
+void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range);
#define W_SetupShot_Dir_ProjectileSize(ent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
#define W_SetupShot_ProjectileSize(ent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
entity fireBullet_trace_callback_eff;
entity fireBullet_last_hit;
void fireBullet_trace_callback(vector start, vector hit, vector end);
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
-#endif
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
-#ifndef WEAPONSTATS_H
-#define WEAPONSTATS_H
+#pragma once
float weaponstats_buffer;
void WeaponStats_LogKill(float awep, float abot, float vwep, float vbot);
#define WEAPONSTATS_GETINDEX(awep,abot,vwep,vbot) (((vwep) + (awep) * (WEP_LAST - WEP_FIRST + 1) - (WEP_FIRST + WEP_FIRST * (WEP_LAST - WEP_FIRST + 1))) * 4 + (abot) * 2 + (vbot))
-#endif
#include <common/notifications/all.qh>
#include <common/util.qh>
#include <common/weapons/all.qh>
+#include <common/state.qh>
#include <lib/csqcmodel/sv_model.qh>
.int state;
{
entity wi = Weapons_from(wpn);
entity e = spawn();
- CL_WeaponEntity_SetModel(e, wi.mdl);
+ CL_WeaponEntity_SetModel(e, wi.mdl, false);
vector ret = e.movedir;
- CL_WeaponEntity_SetModel(e, "");
+ CL_WeaponEntity_SetModel(e, "", false);
remove(e);
return ret;
}
remove(this);
return;
}
- if (IS_DEAD(self.owner))
+ if (IS_DEAD(this.owner))
{
// owner died; disappear
this.model = "";
this.dmg = this.owner.modelindex;
this.deadflag = this.owner.deadflag;
- CL_WeaponEntity_SetModel(this, this.owner.weaponname);
+ CL_WeaponEntity_SetModel(this, this.owner.weaponname, true);
}
this.alpha = -1; // TODO: don't render this entity at all
remove(this);
return;
}
- if (IS_DEAD(self.owner))
+ if (IS_DEAD(this.owner))
{
this.model = "";
return;
else if (this.owner.alpha != 0) this.alpha = this.owner.alpha;
else this.alpha = 1;
- this.glowmod = weaponentity_glowmod(PS(this.owner).m_weapon, this.owner.clientcolors);
+ Weapon wep = PS(this.owner).m_weapon;
+ if (wep) this.glowmod = weaponentity_glowmod(wep, this.owner.clientcolors);
this.colormap = this.owner.colormap;
CSQCMODEL_AUTOUPDATE(this);
.float prevwarntime;
bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary)
{
+ SELFPARAM();
if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
bool ammo = false;
- if (secondary) WITH(entity, self, actor, ammo = thiswep.wr_checkammo2(thiswep));
- else WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
+ if (secondary) WITHSELF(actor, ammo = thiswep.wr_checkammo2(thiswep));
+ else WITHSELF(actor, ammo = thiswep.wr_checkammo1(thiswep));
if (ammo) return true;
// always keep the Mine Layer if we placed mines, so that we can detonate them
if (thiswep == WEP_MINE_LAYER)
// check if the other firing mode has enough ammo
bool ammo_other = false;
- if (secondary) WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo1(thiswep));
- else WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo2(thiswep));
+ if (secondary) WITHSELF(actor, ammo_other = thiswep.wr_checkammo1(thiswep));
+ else WITHSELF(actor, ammo_other = thiswep.wr_checkammo2(thiswep));
if (ammo_other)
{
if (time - actor.prevwarntime > 1)
.bool hook_switchweapon;
-void W_WeaponFrame(entity actor)
+void W_WeaponFrame(Player actor)
{
+ TC(Player, actor);
+ TC(PlayerState, PS(actor));
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
entity this = actor.(weaponentity);
if (frametime) actor.weapon_frametime = frametime;
// if (actor.button0)
// print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor, slot)), " >= ", ftos(this.weapon_nextthink), "\n");
- int w = PS(actor).m_weapon.m_id;
+ Weapon w = PS(actor).m_weapon;
// call the think code which may fire the weapon
// and do so multiple times to resolve framerate dependency issues if the
// server framerate is very low and the weapon fire rate very high
for (int c = 0; c < W_TICSPERFRAME; ++c)
{
- if (w && !(actor.weapons & WepSet_FromWeapon(Weapons_from(w))))
+ if (w != WEP_Null && !(actor.weapons & WepSet_FromWeapon(w)))
{
if (PS(actor).m_weapon == PS(actor).m_switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
- w = 0;
+ w = WEP_Null;
}
v_forward = fo;
if (!block_weapon)
{
- if (w)
+ Weapon e = PS(actor).m_weapon;
+ TC(Weapon, e);
+ if (w != WEP_Null)
{
- Weapon e = PS(actor).m_weapon;
e.wr_think(e, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
}
- else
+ else if (e)
{
- Weapon w = PS(actor).m_weapon;
- w.wr_gonethink(w);
+ e.wr_gonethink(e);
}
}
w_ready(wpn, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
}
-void W_Reload(entity actor, float sent_ammo_min, string sent_sound)
+void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound)
{
+ TC(Sound, sent_sound);
.entity weaponentity = weaponentities[0];
// set global values to work with
Weapon e = PS(actor).m_weapon;
actor.reload_ammo_min = sent_ammo_min;
actor.reload_ammo_amount = e.reloading_ammo;
actor.reload_time = e.reloading_time;
- actor.reload_sound = sent_sound;
+ if (actor.reload_sound) strunzone(actor.reload_sound);
+ actor.reload_sound = strzone(Sound_fixpath(sent_sound));
// don't reload weapons that don't have the RELOADABLE flag
if (!(e.spawnflags & WEP_FLAG_RELOADABLE))
void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
{
+ SELFPARAM();
Weapon w = Weapons_from(weapon_type);
weapon_dropevent_item = weapon_item;
- WITH(entity, self, player, w.event(w));
+ WITHSELF(player, w.event(w));
}
-#ifndef WEAPONSYSTEM_H
-#define WEAPONSYSTEM_H
-
+#pragma once
float internalteam;
float weaponswapping;
void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item);
-void W_Reload(entity actor, float sent_ammo_min, string sent_sound);
+void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound);
-void W_WeaponFrame(entity actor);
+void W_WeaponFrame(Player actor);
float W_WeaponRateFactor();
void weapon_prepareattack_do(entity actor, .entity weaponentity, float secondary, float attacktime);
void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func);
-
-#endif
+++ /dev/null
-#!/bin/bash
-set -eu
-cd "$(dirname "$0")"
-cd ..
-
-declare -a NOWARN=(
- -Wno-field-redeclared
- -Wno-unused-variable
- -Wno-implicit-function-pointer
-)
-declare QCC=../../../gmqcc/gmqcc
-
-declare -a QCC_FLAGS=(
- -std=gmqcc
- -Wall -Werror
- -fftepp -fftepp-predefs -Wcpp
- -futf8
- -freturn-assignments
- -frelaxed-switch
- -Ooverlap-locals
-)
-
-function check() {
- declare -l base="${1}"
- declare -la predefs=("-D${2}" "lib/_all.inc" "${base}/_all.qh")
- find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
- echo "$file"
- ${QCC} "${QCC_FLAGS[@]}" "${NOWARN[@]}" "${predefs[@]}" "$file" >/dev/null
- done
-}
-
-check client CSQC
-check server SVQC
-check menu MENUQC
--- /dev/null
+#!/bin/sh
+set -ex
+git checkout divVerent/autocvarizer_test
+trap 'git reset --hard; git checkout divVerent/autocvarizer' EXIT
+trap 'exit 1' INT
+git merge --no-commit -s ours divVerent/autocvarizer
+git read-tree -m -u divVerent/autocvarizer # "theirs"
+find server \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | AUTOCVARING_SVQC=1 xargs -0 perl autocvarize.pl > server/autocvars.qh.new
+diff -Nu server/autocvars.qh server/autocvars.qh.new || true
+mv server/autocvars.qh.new server/autocvars.qh
+find client \( -type f -a \( -name \*.c -o -name \*.qc -o -name \*.h -o -name \*.qh \) \) -print0 | xargs -0 perl autocvarize.pl > client/autocvars.qh.new
+diff -Nu client/autocvars.qh client/autocvars.qh.new || true
+mv client/autocvars.qh.new client/autocvars.qh
+if make -C .. FTEQCC=../../../../fteqcc/fteqcc.bin FTEQCCFLAGS=; then
+ echo "Commit? ^C to not"
+ read -r L
+ git add server/autocvars.qh
+ git add client/autocvars.qh
+ git commit -a
+else
+ echo "FAILED. Exit this shell when done examining."
+ sh -i
+fi
--- /dev/null
+#!/usr/bin/perl
+# this tool generates JUST the autocvar declarations for cvars
+use strict;
+use warnings;
+
+my @files = @ARGV;
+
+my %cvars = ();
+my %old = ();
+my %menu = ();
+my %defaults = ();
+
+sub found($$$$)
+{
+ my ($name, $type, $default, $force) = @_;
+ if(length $name >= 55)
+ {
+ warn "cvar $name is a Dr. honorificabilitudinitatibis causa BRLOGENSHFEGLE";
+ $type = 'cvar_toolong';
+ return;
+ }
+# $old{$name} = 1
+# if $force;
+# $menu{$name} = 1
+# if $force > 1;
+ if(exists $cvars{$name} and not defined $cvars{name})
+ {
+ # have already warned
+ }
+ elsif(exists $cvars{$name} and $type ne $cvars{$name})
+ {
+ warn "cvar $name used with different types";
+ if($force)
+ {
+ $defaults{$name} = $default;
+ $cvars{$name} = $type;
+ }
+ else
+ {
+ undef $cvars{$name}
+ unless $old{$name};
+ }
+ return;
+ }
+ elsif(exists $cvars{$name} and exists $defaults{$name} and $default ne $defaults{$name})
+ {
+ warn "cvar $name used with different defaults";
+ if($force)
+ {
+ $defaults{$name} = $default;
+ $cvars{$name} = $type;
+ }
+ else
+ {
+ undef $cvars{$name}
+ unless $old{$name};
+ }
+ }
+ else
+ {
+ $defaults{$name} = $default;
+ $cvars{$name} = $type;
+ }
+}
+
+for my $f(@files)
+{
+ print STDERR "In file $f\n";
+ open my $fh, "<", $f;
+ while(<$fh>)
+ {
+ chomp;
+ if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
+ {
+ next;
+ }
+ s/\/\/.*//;
+ if(/^(?:var )?float autocvar_(\w+);$/)
+ {
+ found $1, 'cvar', 0, 1;
+ next;
+ }
+ if(/^var float autocvar_(\w+) = (.*);$/)
+ {
+ found $1, 'cvar', $2, 1;
+ next;
+ }
+ if(/^(?:var )?vector autocvar_(\w+);$/)
+ {
+ found $1, 'cvar_vector', "0 0 0", 1;
+ next;
+ }
+ if(/^var vector autocvar_(\w+) = '(.*)';$/)
+ {
+ found $1, 'cvar_vector', $2, 1;
+ next;
+ }
+ if(/^(?:var )?string autocvar_(\w+);$/)
+ {
+ found $1, 'cvar_string', "", 1;
+ next;
+ }
+ if(/^var string autocvar_(\w+) = "(.*)";$/)
+ {
+ found $1, 'cvar_string', $2, 1;
+ next;
+ }
+ if(/^#define autocvar_(\w+) cvar("\1")$/)
+ {
+ found $1, 'cvar', 0, 2;
+ next;
+ }
+ if(/^#define autocvar_(\w+) cvar_or("\1", (.*))$/)
+ {
+ found $1, 'cvar', $1, 2;
+ next;
+ }
+ if(/^#define autocvar_(\w+) cvar_string("\1")$/)
+ {
+ found $1, 'cvar_string', "", 2;
+ next;
+ }
+ while(/\bcvar\s*\(\s*"(\w+)"\s*\)/g)
+ {
+ found $1, 'cvar', 0, 0;
+ }
+ while(/\bcvar_string\s*\(\s*"(\w+)"\s*\)/g)
+ {
+ found $1, 'cvar_string', "", 0;
+ }
+ while(/\bcvar_vector\s*\(\s*"(\w+)"\s*\)/g)
+ {
+ found $1, 'cvar_vector', "0 0 0", 0;
+ }
+ while(/\bcvar_or\s*\(\s*"(\w+)"\s*,\s*([^\s)]+)\s*\)/g)
+ {
+ found $1, 'cvar', $2, 0;
+ }
+ }
+}
+
+if($ENV{AUTOCVARING_SVQC})
+{
+ for my $f(<menu/xonotic/*.c>)
+ {
+ print STDERR "In file $f\n";
+ open my $fh, "<", $f;
+ while(<$fh>)
+ {
+ for(/"([^"]*)"/g)
+ {
+ $menu{$1} = 1;
+ }
+ }
+ }
+
+ for my $f(<../maps/campaign*.txt>)
+ {
+ print STDERR "In file $f\n";
+ open my $fh, "<", $f;
+ while(<$fh>)
+ {
+ for(/\b(.+?)\b/g)
+ {
+ $menu{$1} = 1;
+ }
+ }
+ }
+}
+
+for my $name(sort keys %cvars)
+{
+ my $type = $cvars{$name};
+ my $menu = $menu{$name};
+ my $default = $defaults{$name};
+ die "wtf" if $name =~ /\0/;
+ if(not defined $type)
+ {
+ print "// cannot declare $name, it is used with different types\n";
+ }
+ elsif($type eq 'cvar_toolong')
+ {
+ print "// cannot declare $name, name is too long\n";
+ }
+ elsif($type eq 'cvar' and not $menu and $default eq "0")
+ {
+ print "float autocvar_$name;\n";
+ }
+ elsif($type eq 'cvar' and not $menu and $default ne "0")
+ {
+ print "var float autocvar_$name = $default;\n";
+ }
+ elsif($type eq 'cvar_vector' and not $menu and $default eq "0 0 0")
+ {
+ print "vector autocvar_$name;\n";
+ }
+ elsif($type eq 'cvar_vector' and not $menu and $default ne "0 0 0")
+ {
+ print "var vector autocvar_$name = '$default';\n";
+ }
+ elsif($type eq 'cvar_string' and not $menu and $default eq "")
+ {
+ print "string autocvar_$name;\n";
+ }
+ elsif($type eq 'cvar_string' and not $menu and $default ne "")
+ {
+ print "var string autocvar_$name = \"$default\";\n";
+ }
+ elsif($type eq 'cvar' and $menu and $default eq "0")
+ {
+ print "#define autocvar_$name cvar(\"$name\")\n";
+ }
+ elsif($type eq 'cvar' and $menu and $default ne "0")
+ {
+ print "#define autocvar_$name cvar_or(\"$name\", \"$default\")\n";
+ }
+ elsif($type eq 'cvar_string' and $menu) # sorry, no cvar_or for these
+ {
+ print "#define autocvar_$name cvar_string(\"$name\")\n";
+ }
+ elsif($type eq 'cvar_vector' and $menu) # sorry, no cvar_or for these
+ {
+ print "#define autocvar_$name cvar_vector(\"$name\")\n";
+ }
+}
+
+for my $f(@files)
+{
+ print STDERR "In file $f\n";
+ open my $fh, "<", $f;
+ my $out = "";
+ while(<$fh>)
+ {
+ chomp;
+ if(/^\/\/#NO AUTOCVARS START/ .. /^\/\/#NO AUTOCVARS END/)
+ {
+ $out .= "$_\n";
+ next;
+ }
+ if(/^(?:var )?float autocvar_(.*);$/)
+ {
+ $out .= "$_\n";
+ next;
+ }
+ if(/^(?:var )?string autocvar_(.*);$/)
+ {
+ $out .= "$_\n";
+ next;
+ }
+ if(/^#define autocvar_(.*) cvar/)
+ {
+ $out .= "$_\n";
+ next;
+ }
+ s{\b(cvar|cvar_string|cvar_vector|cvar_or)\s*\(\s*"([^"]+)"\s*(?:,\s*[^\s)]+\s*)?\)}{
+ my ($type, $name) = ($1, $2);
+ $type = 'cvar' if $type eq 'cvar_or';
+ my $realtype = $cvars{$name};
+ my $r = $&;
+ if(defined $realtype)
+ {
+ #$r = "$realtype(\"$name\")";
+ $r = "autocvar_$name";
+ if($type eq 'cvar' && $realtype eq 'cvar_string')
+ {
+ $r = "stof($r)";
+ }
+ if($type eq 'cvar_string' && $realtype eq 'cvar')
+ {
+ $r = "ftos($r)";
+ }
+ }
+ $r;
+ }ge;
+ $out .= "$_\n";
+ }
+ close $fh;
+ open $fh, ">", $f;
+ print $fh $out;
+ close $fh;
+}
--- /dev/null
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+
+WORKDIR=../.tmp
+
+CPP="cc -xc -E"
+: ${QCC:=$PWD/../../../../gmqcc/gmqcc}
+
+declare -a QCCDEFS=(
+ -DNDEBUG=1
+ -DWATERMARK="\"$(git describe --tags --dirty='~')\""
+ -DDEBUGPATHING=0
+)
+QCCDEFS="${QCCDEFS[@]}"
+
+declare -a QCCFLAGS=(
+ -std=gmqcc
+ -Wall -Werror
+ -futf8
+ -freturn-assignments
+ -frelaxed-switch
+ -Ooverlap-locals
+)
+declare -a NOWARN=(
+ -Wno-field-redeclared
+ -Wno-unused-variable
+ -Wno-implicit-function-pointer
+ -Wno-missing-return-values
+)
+QCCFLAGS="${QCCFLAGS[@]} ${NOWARN[@]}"
+
+. qcc.sh
+cd ..
+
+function check1() {
+ declare -l base="${1}"
+ MODE=${2}
+ declare -l file="${3}"
+ qpp ${file} test.dat \
+ -include lib/_all.inc -include ${base}/_all.qh \
+ -I. ${QCCIDENT} ${QCCDEFS} -D${MODE} > ${WORKDIR}/${MODE}.qc
+ qcc ${QCCFLAGS} -o ../${WORKDIR}/test.dat ../${WORKDIR}/${MODE}.qc >/dev/null
+}
+
+function check() {
+ declare -l base="${1}"
+ MODE=${2}
+ find ${base} -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
+ check1 ${base} ${MODE} ${file}
+ done
+}
+
+check client CSQC
+check server SVQC
+check menu MENUQC
--- /dev/null
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+MOD=_mod.inc
+
+function genmod() {
+ echo '// generated file; do not modify' > ${MOD}
+ for f in $(ls | sort -k 1,1 -t .); do
+ if [[ "$f" == *.qc ]]; then echo "#include \"$f\"" >> ${MOD}; fi
+ done
+ # echo >> ${MOD}
+ for f in *; do if [ -d "$f" ]; then
+ (cd -- "$f" && genmod)
+ # echo "#include \"$f/MOD\"" >> ${MOD}
+ fi; done
+}
+
+(cd lib; genmod)
+(cd common; genmod)
+(cd client; genmod)
+(cd server; genmod)
+(cd menu; genmod)
--- /dev/null
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+function startswith() {
+ declare -l file="${1}"
+ declare -l prelude="${2}"
+ declare -l line=$(head -n1 "$file")
+ if [ "$line" != "$prelude" ]; then
+ echo "$prelude" | cat - "$file" > "$file.tmp" && mv "$file.tmp" "$file"
+ fi
+}
+
+function check() {
+ declare -l base="${1}"
+ find "$base" -type f -name '*.qc' -print0 | sort -z | while read -r -d '' file; do
+ echo "$file"
+ declare -l file_h="${file%.qc}.qh"
+ if [ ! -f "$file_h" ]; then echo "#pragma once" > "$file_h"; fi
+
+ include=$(basename "$file")
+ include="${include%.qc}.qh"
+ include="#include \"${include}\""
+ startswith "$file" "$include"
+ done
+ find "$base" -type f -name '*.qh' -print0 | sort -z | while read -r -d '' file; do
+ echo "$file"
+ startswith "$file" "#pragma once"
+ done
+}
+
+check client
+check server
+check menu
--- /dev/null
+#!/bin/bash
+set -euo pipefail
+IFS=$' \n\t'
+
+WORKDIR=${WORKDIR}
+CPP=${CPP}
+QCC=${QCC}
+QCCIDENT="-DGMQCC"
+QCCDEFS=${QCCDEFS}
+QCCFLAGS=${QCCFLAGS}
+
+function qpp() {
+ IN=$1
+ OUT=$2
+ >&2 echo + ${CPP} ${@:3} ${IN}
+ set +e
+ # additional information
+ ${CPP} ${@:3} \
+ -dM 1>${WORKDIR}/${MODE}_macros.txt \
+ -H 2>${WORKDIR}/${MODE}_includes.txt \
+ ${IN}
+ # main step
+ ${CPP} ${@:3} -MMD -MP -MT ${OUT} -Wall -Wundef -Werror ${IN} -o ${WORKDIR}/${MODE}.txt
+ err=$?
+ set -e
+ if [ ${err} -ne 0 ]; then return ${err}; fi
+ sed 's/^#\(line\)\? \([[:digit:]]\+\) "\(.*\)".*/\n#pragma file(\3)\n#pragma line(\2)/g' ${WORKDIR}/${MODE}.txt
+}
+
+function qcc() {
+ >&2 echo + $(basename ${QCC}) $@
+ # FIXME: relative compiler path is too deep
+ (cd tools && ${QCC} $@)
+}
+
+$(return >/dev/null 2>&1) || {
+ MODE=$1
+ OUT=$2
+ IN=$3
+
+ case ${MODE} in
+ client) PROG=CSQC
+ ;;
+ menu) PROG=MENUQC
+ ;;
+ server) PROG=SVQC
+ ;;
+ esac
+
+ qpp ${IN} ${OUT} -I. ${QCCIDENT} ${QCCDEFS} -D${PROG} > ${WORKDIR}/${MODE}.qc
+ qcc ${QCCFLAGS} -o ${OUT} ../${WORKDIR}/${MODE}.qc
+}
--- /dev/null
+FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
+out_raw()
+{
+ printf "%s\n" "$LINE"
+}
+out()
+{
+ printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
+}
+decide()
+{
+ verybestchoice=
+ verybestscore=2147483647
+ bestchoice=
+ bestscore=2147483647
+ secondbestchoice=
+ secondbestscore=2147483647
+ worstscore=0
+ haveignore=false
+ havefalse=false
+ have0=false
+ seen=
+ for choice in "$VAL" "$@"; do
+ case " $seen " in
+ *" $choice "*)
+ continue
+ ;;
+ *)
+ seen=$seen" $VAL"
+ ;;
+ esac
+ if [ x"$choice" = x"force" ]; then
+ continue
+ fi
+ if [ x"$choice" = x"ignore" ]; then
+ haveignore=true
+ fi
+ if [ x"$choice" = x"false" ]; then
+ havefalse=true
+ fi
+ if [ x"$choice" = x"0" ]; then
+ have0=true
+ fi
+ if [ x"$MODE" = x"initialize" ]; then
+ if [ x"$choice" = x"ignore" ]; then
+ score=0
+ else
+ score=2147483647
+ fi
+ else
+ {
+ cat uncrustify.cfg
+ printf "%s = %s\n" "$KEY" "$choice"
+ } > uncrustify.cfg.test
+ UNCRUSTIFY_CONFIG=uncrustify.cfg.test sh uncrustify.sh $FILES >/dev/null 2>&1
+ status=$?
+ if [ $status -gt 1 ]; then
+ echo "# ERROR: $KEY = $choice crashes with status $status."
+ continue
+ fi
+ score=0
+ git diff --numstat > diffstat.tmp
+ while read -r add del rest; do
+ if [ x"$add" != x"-" ]; then
+ score=$(($score + $add))
+ fi
+ if [ x"$del" != x"-" ]; then
+ score=$(($score + $del))
+ fi
+ done < diffstat.tmp
+ git reset --hard >/dev/null 2>&1
+ fi
+ echo >&2 "$KEY = $choice: $score"
+ if [ x"$choice" != x"ignore" ]; then
+ if [ $score -lt $bestscore ]; then
+ secondbestscore=$bestscore
+ secondbestchoice=$bestchoice
+ bestscore=$score
+ bestchoice=$choice
+ elif [ $score -lt $secondbestscore ]; then
+ secondbestscore=$score
+ secondbestchoice=$choice
+ fi
+ fi
+ if [ $score -lt $verybestscore ]; then
+ verybestscore=$score
+ verybestchoice=$choice
+ fi
+ if [ $score -gt $worstscore ]; then
+ worstscore=$score
+ worstchoice=$choice
+ fi
+ done
+ if [ -z "$bestchoice" ]; then
+ echo "# WARNING: No best choice identified"
+ elif [ $verybestscore -ge $worstscore ]; then
+ echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
+ if $haveignore; then
+ VAL=ignore
+ elif $havefalse; then
+ VAL=false
+ elif $have0; then
+ VAL=0
+ fi
+ elif [ $bestscore -ge $worstscore ]; then
+ echo "# WARNING: Indifferent... please decide manually."
+ elif [ $bestscore -ge $secondbestscore ]; then
+ echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
+ elif [ $bestscore -gt $verybestscore ]; then
+ echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
+ VAL=$bestchoice
+ else
+ VAL=$bestchoice
+ fi
+}
+while read -r LINE; do
+ case "$LINE" in
+ "# NOTE: "*)
+ continue
+ ;;
+ "# WARNING: "*)
+ continue
+ ;;
+ "# ERROR: "*)
+ continue
+ ;;
+ "#"*)
+ out_raw
+ continue
+ ;;
+ *"#force"*|*"#ignore"*)
+ out_raw
+ continue
+ ;;
+ esac
+ printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
+ if \
+ [ x"$EQ" != x"=" ] || \
+ [ x"$DELIM" != x"#" ]; then
+ out_raw
+ continue
+ fi
+ case "$COMMENT" in
+ number)
+ case "$KEY" in
+ indent_columns|*tab*)
+ decide 1 2 4 8
+ ;;
+ *)
+ decide 0 1 2 3 indent_columns
+ ;;
+ esac
+ out
+ ;;
+ string)
+ printf "# WARNING: unsupported %s\n" "$COMMENT"
+ out_raw
+ ;;
+ *[!a-z/_]*)
+ printf "# ERROR: invalid characters %s\n" "$COMMENT"
+ out_raw
+ ;;
+ */*)
+ decide `echo "$COMMENT" | tr / ' '`
+ out
+ ;;
+ *)
+ printf "# ERROR: only once choice %s\n" "$COMMENT"
+ out_raw
+ ;;
+ esac
+ done
+done < uncrustify.cfg
--- /dev/null
+fix_function_types() {
+ # Uncrustify handles QC function types (example:
+ # void(void) func;
+ # ) wrong and removes the space between type and variable. Fix this by
+ # a simple sed on ")letter" which should normally not occur.
+ sed -e 's/)\([A-Za-z_]\)/) \1/g' "$@"
+}
+
+if [ -z "$UNCRUSTIFY_CONFIG" ]; then
+ UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg
+fi
+
+case "$#" in
+ 0)
+ uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\
+ fix_function_types
+ ;;
+ *)
+ uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" ;\
+ fix_function_types -i "$@"
+ ;;
+esac
--- /dev/null
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+function check() {
+ declare -l base="${1}"
+ find "$base" -type f -print0 | sort -z | xargs -0 sed -i \
+ `# strip trailing spaces` \
+ -e 's/[[:space:]]*$//' \
+ `# line feed at EOF for #include to work properly` \
+ -e '$a\'
+}
+
+check lib
+check common
+check client
+check server
+check menu
+++ /dev/null
-FILES=`find client common menu server warpzonelib -name \*.c -o -name \*.h -o -name \*.qc -o -name \*.qh`
-out_raw()
-{
- printf "%s\n" "$LINE"
-}
-out()
-{
- printf "%-40s = %-8s # %s\n" "$KEY" "$VAL" "$COMMENT"
-}
-decide()
-{
- verybestchoice=
- verybestscore=2147483647
- bestchoice=
- bestscore=2147483647
- secondbestchoice=
- secondbestscore=2147483647
- worstscore=0
- haveignore=false
- havefalse=false
- have0=false
- seen=
- for choice in "$VAL" "$@"; do
- case " $seen " in
- *" $choice "*)
- continue
- ;;
- *)
- seen=$seen" $VAL"
- ;;
- esac
- if [ x"$choice" = x"force" ]; then
- continue
- fi
- if [ x"$choice" = x"ignore" ]; then
- haveignore=true
- fi
- if [ x"$choice" = x"false" ]; then
- havefalse=true
- fi
- if [ x"$choice" = x"0" ]; then
- have0=true
- fi
- if [ x"$MODE" = x"initialize" ]; then
- if [ x"$choice" = x"ignore" ]; then
- score=0
- else
- score=2147483647
- fi
- else
- {
- cat uncrustify.cfg
- printf "%s = %s\n" "$KEY" "$choice"
- } > uncrustify.cfg.test
- UNCRUSTIFY_CONFIG=uncrustify.cfg.test sh uncrustify.sh $FILES >/dev/null 2>&1
- status=$?
- if [ $status -gt 1 ]; then
- echo "# ERROR: $KEY = $choice crashes with status $status."
- continue
- fi
- score=0
- git diff --numstat > diffstat.tmp
- while read -r add del rest; do
- if [ x"$add" != x"-" ]; then
- score=$(($score + $add))
- fi
- if [ x"$del" != x"-" ]; then
- score=$(($score + $del))
- fi
- done < diffstat.tmp
- git reset --hard >/dev/null 2>&1
- fi
- echo >&2 "$KEY = $choice: $score"
- if [ x"$choice" != x"ignore" ]; then
- if [ $score -lt $bestscore ]; then
- secondbestscore=$bestscore
- secondbestchoice=$bestchoice
- bestscore=$score
- bestchoice=$choice
- elif [ $score -lt $secondbestscore ]; then
- secondbestscore=$score
- secondbestchoice=$choice
- fi
- fi
- if [ $score -lt $verybestscore ]; then
- verybestscore=$score
- verybestchoice=$choice
- fi
- if [ $score -gt $worstscore ]; then
- worstscore=$score
- worstchoice=$choice
- fi
- done
- if [ -z "$bestchoice" ]; then
- echo "# WARNING: No best choice identified"
- elif [ $verybestscore -ge $worstscore ]; then
- echo "# WARNING: Code doesn't seem to use this feature - delete from the config?"
- if $haveignore; then
- VAL=ignore
- elif $havefalse; then
- VAL=false
- elif $have0; then
- VAL=0
- fi
- elif [ $bestscore -ge $worstscore ]; then
- echo "# WARNING: Indifferent... please decide manually."
- elif [ $bestscore -ge $secondbestscore ]; then
- echo "# WARNING: Best is not unique ($bestchoice $secondbestchoice)"
- elif [ $bestscore -gt $verybestscore ]; then
- echo "# NOTE: is $(($bestscore - $verybestscore)) worse than $verybestchoice"
- VAL=$bestchoice
- else
- VAL=$bestchoice
- fi
-}
-while read -r LINE; do
- case "$LINE" in
- "# NOTE: "*)
- continue
- ;;
- "# WARNING: "*)
- continue
- ;;
- "# ERROR: "*)
- continue
- ;;
- "#"*)
- out_raw
- continue
- ;;
- *"#force"*|*"#ignore"*)
- out_raw
- continue
- ;;
- esac
- printf "%s\n" "$LINE" | while read KEY EQ VAL DELIM COMMENT; do
- if \
- [ x"$EQ" != x"=" ] || \
- [ x"$DELIM" != x"#" ]; then
- out_raw
- continue
- fi
- case "$COMMENT" in
- number)
- case "$KEY" in
- indent_columns|*tab*)
- decide 1 2 4 8
- ;;
- *)
- decide 0 1 2 3 indent_columns
- ;;
- esac
- out
- ;;
- string)
- printf "# WARNING: unsupported %s\n" "$COMMENT"
- out_raw
- ;;
- *[!a-z/_]*)
- printf "# ERROR: invalid characters %s\n" "$COMMENT"
- out_raw
- ;;
- */*)
- decide `echo "$COMMENT" | tr / ' '`
- out
- ;;
- *)
- printf "# ERROR: only once choice %s\n" "$COMMENT"
- out_raw
- ;;
- esac
- done
-done < uncrustify.cfg
# QC OO
macro-open CLASS
-macro-else EXTENDS
macro-close ENDCLASS
# translations
+++ /dev/null
-fix_function_types() {
- # Uncrustify handles QC function types (example:
- # void(void) func;
- # ) wrong and removes the space between type and variable. Fix this by
- # a simple sed on ")letter" which should normally not occur.
- sed -e 's/)\([A-Za-z_]\)/) \1/g' "$@"
-}
-
-if [ -z "$UNCRUSTIFY_CONFIG" ]; then
- UNCRUSTIFY_CONFIG=`git rev-parse --show-toplevel`/qcsrc/uncrustify.cfg
-fi
-
-case "$#" in
- 0)
- uncrustify --frag -c "$UNCRUSTIFY_CONFIG" |\
- fix_function_types
- ;;
- *)
- uncrustify --replace --no-backup -c "$UNCRUSTIFY_CONFIG" "$@" ;\
- fix_function_types -i "$@"
- ;;
-esac
+++ /dev/null
-#!/usr/bin/env bash
-cd ${0%[\\/]*}
-find . -name .git -prune -o -type f -print0 | \
- xargs -0 sed -i \
- `# strip trailing spaces` \
- -e 's/[[:space:]]*$//' \
- `# line feed at EOF for #include to work properly` \
- -e '$a\'
set g_turrets_unit_ewheel_track_type 1
set g_turrets_unit_ewheel_track_accel_pitch 0
set g_turrets_unit_ewheel_track_accel_rot 0
+
+set g_turrets_unit_ewheel_track_blendrate 0
// }}}
// {{{ #2: FLAC Cannon
set g_turrets_unit_flac_health 700
set g_turrets_unit_tesla_ammo_max 1000
set g_turrets_unit_tesla_ammo 200
set g_turrets_unit_tesla_ammo_recharge 15
+
+set g_turrets_unit_tesla_shot_radius 0
+set g_turrets_unit_tesla_shot_speed 0
+set g_turrets_unit_tesla_shot_spread 0
+set g_turrets_unit_tesla_target_range_optimal 0
+set g_turrets_unit_tesla_target_select_rangebias 0
+set g_turrets_unit_tesla_target_select_samebias 0
+set g_turrets_unit_tesla_target_select_anglebias 0
+set g_turrets_unit_tesla_aim_firetolerance_dist 0
+set g_turrets_unit_tesla_aim_speed 0
+set g_turrets_unit_tesla_aim_maxrot 0
+set g_turrets_unit_tesla_aim_maxpitch 0
+set g_turrets_unit_tesla_track_type 0
+set g_turrets_unit_tesla_track_accel_pitch 0
+set g_turrets_unit_tesla_track_accel_rot 0
+set g_turrets_unit_tesla_track_blendrate 0
// }}}
// {{{ #12: Walker Turret
set g_turrets_unit_walker_health 500
+++ /dev/null
-set g_vehicle_bumblebee_respawntime 60
-
-set g_vehicle_bumblebee_speed_forward 350
-set g_vehicle_bumblebee_speed_strafe 350
-set g_vehicle_bumblebee_speed_up 350
-set g_vehicle_bumblebee_speed_down 350
-set g_vehicle_bumblebee_turnspeed 120
-set g_vehicle_bumblebee_pitchspeed 60
-set g_vehicle_bumblebee_pitchlimit 60
-set g_vehicle_bumblebee_friction 0.5
-
-set g_vehicle_bumblebee_energy 500
-set g_vehicle_bumblebee_energy_regen 50
-set g_vehicle_bumblebee_energy_regen_pause 1
-
-set g_vehicle_bumblebee_health 1000
-set g_vehicle_bumblebee_health_regen 65
-set g_vehicle_bumblebee_health_regen_pause 10
-
-set g_vehicle_bumblebee_shield 400
-set g_vehicle_bumblebee_shield_regen 150
-set g_vehicle_bumblebee_shield_regen_pause 0.75
-
-set g_vehicle_bumblebee_cannon_lock 0
-set g_vehicle_bumblebee_cannon_cost 2
-set g_vehicle_bumblebee_cannon_damage 60
-set g_vehicle_bumblebee_cannon_radius 225
-set g_vehicle_bumblebee_cannon_refire 0.2
-set g_vehicle_bumblebee_cannon_speed 20000
-set g_vehicle_bumblebee_cannon_spread 0.02
-set g_vehicle_bumblebee_cannon_force -35
-set g_vehicle_bumblebee_cannon_turnspeed 160
-set g_vehicle_bumblebee_cannon_pitchlimit_down 60
-set g_vehicle_bumblebee_cannon_pitchlimit_up 60
-set g_vehicle_bumblebee_cannon_turnlimit_in 20
-set g_vehicle_bumblebee_cannon_turnlimit_out 80
-set g_vehicle_bumblebee_cannon_ammo 100
-set g_vehicle_bumblebee_cannon_ammo_regen 100
-set g_vehicle_bumblebee_cannon_ammo_regen_pause 1
-
-set g_vehicle_bumblebee_raygun_turnspeed 180
-set g_vehicle_bumblebee_raygun_pitchlimit_down 20
-set g_vehicle_bumblebee_raygun_pitchlimit_up 5
-set g_vehicle_bumblebee_raygun_turnlimit_sides 35
-
-set g_vehicle_bumblebee_raygun 0
-set g_vehicle_bumblebee_raygun_range 2048
-set g_vehicle_bumblebee_raygun_dps 250
-set g_vehicle_bumblebee_raygun_aps 100
-set g_vehicle_bumblebee_raygun_fps 100
-
-set g_vehicle_bumblebee_healgun_hps 150
-set g_vehicle_bumblebee_healgun_hmax 100
-set g_vehicle_bumblebee_healgun_aps 75
-set g_vehicle_bumblebee_healgun_amax 100
-set g_vehicle_bumblebee_healgun_sps 100
-set g_vehicle_bumblebee_healgun_smax 100
-set g_vehicle_bumblebee_healgun_locktime 2.5
-
-set g_vehicle_bumblebee_blowup_radius 500
-set g_vehicle_bumblebee_blowup_coredamage 500
-set g_vehicle_bumblebee_blowup_edgedamage 100
-set g_vehicle_bumblebee_blowup_forceintensity 600
-set g_vehicle_bumblebee_bouncepain "1 100 200"
\ No newline at end of file
+++ /dev/null
-set g_vehicle_racer_respawntime 35
-
-set g_vehicle_racer_health 200
-set g_vehicle_racer_health_regen 0
-set g_vehicle_racer_health_regen_pause 0
-
-set g_vehicle_racer_shield 100
-set g_vehicle_racer_shield_regen 30
-set g_vehicle_racer_shield_regen_pause 1
-
-set g_vehicle_racer_energy 100
-set g_vehicle_racer_energy_regen 50
-set g_vehicle_racer_energy_regen_pause 1
-
-set g_vehicle_racer_speed_stop 2500
-set g_vehicle_racer_speed_forward 650
-set g_vehicle_racer_speed_strafe 650
-set g_vehicle_racer_speed_afterburn 3000
-set g_vehicle_racer_friction 0.45
-set g_vehicle_racer_afterburn_cost 100 // energy consumed per second
-
-set g_vehicle_racer_waterburn_speed 750
-set g_vehicle_racer_waterburn_cost 5
-set g_vehicle_racer_water_speed_forward 600
-set g_vehicle_racer_water_speed_strafe 600
-
-set g_vehicle_racer_hovertype 0 // 0 = hover, != 0 = maglev
-set g_vehicle_racer_hoverpower 8000 // NOTE!! x 4 (4 engines)
-set g_vehicle_racer_upforcedamper 10
-
-set g_vehicle_racer_downforce 0.01
-set g_vehicle_racer_springlength 70
-set g_vehicle_racer_collision_multiplier 0.05
-set g_vehicle_racer_anglestabilizer 1.75
-
-set g_vehicle_racer_turnspeed 220
-set g_vehicle_racer_pitchspeed 125
-set g_vehicle_racer_maxpitch 25
-set g_vehicle_racer_turnroll 30
-
-set g_vehicle_racer_cannon_speed 15000
-set g_vehicle_racer_cannon_damage 15
-set g_vehicle_racer_cannon_radius 100
-set g_vehicle_racer_cannon_refire 0.05
-set g_vehicle_racer_cannon_cost 2
-set g_vehicle_racer_cannon_spread 0.0125
-set g_vehicle_racer_cannon_force 50
-
-set g_vehicle_racer_rocket_speed 900
-set g_vehicle_racer_rocket_accel 1600
-set g_vehicle_racer_rocket_turnrate 0.2
-set g_vehicle_racer_rocket_damage 100
-set g_vehicle_racer_rocket_force 350
-set g_vehicle_racer_rocket_radius 125
-set g_vehicle_racer_rocket_refire 3
-set g_vehicle_racer_rocket_cost 0
-set g_vehicle_racer_rocket_climbspeed 1600
-
-set g_vehicle_racer_rocket_locktarget 1
-set g_vehicle_racer_rocket_locking_time 0.9
-set g_vehicle_racer_rocket_locking_releasetime 0.5
-set g_vehicle_racer_rocket_locked_time 4
-set g_vehicle_racer_rocket_locked_maxangle 1.8
-
-set g_vehicle_racer_blowup_radius 250
-set g_vehicle_racer_blowup_coredamage 250
-set g_vehicle_racer_blowup_edgedamage 15
-set g_vehicle_racer_blowup_forceintensity 250
-
-set g_vehicle_racer_bouncefactor 0.25 // Factor of old velocity to keep after colission
-set g_vehicle_racer_bouncestop 0 // if != 0, New veloctiy after bounce = 0 if new velocity < this
-set g_vehicle_racer_bouncepain "60 0.75 300" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
-
-set g_vehicle_racer_mass 900
+++ /dev/null
-set g_vehicle_raptor_respawntime 40
-
-// 0: go where player aims, +forward etc relative to aim angles
-// 1: ignore aim for up/down movement. +forward always moved forward, +jump always moves up
-set g_vehicle_raptor_movestyle 1
-
-set g_vehicle_raptor_turnroll 0.4
-
-set g_vehicle_raptor_takeofftime 1.5
-
-set g_vehicle_raptor_turnspeed 200
-set g_vehicle_raptor_pitchspeed 50
-set g_vehicle_raptor_pitchlimit 45
-
-set g_vehicle_raptor_speed_forward 1700
-set g_vehicle_raptor_speed_strafe 900
-set g_vehicle_raptor_speed_up 1700
-set g_vehicle_raptor_speed_down 1700
-set g_vehicle_raptor_friction 2
-
-set g_vehicle_raptor_bomblets 8
-set g_vehicle_raptor_bomblet_alt 750
-set g_vehicle_raptor_bomblet_time 0.5
-set g_vehicle_raptor_bomblet_spread 0.4
-set g_vehicle_raptor_bomblet_damage 55
-set g_vehicle_raptor_bomblet_edgedamage 25
-set g_vehicle_raptor_bomblet_radius 350
-set g_vehicle_raptor_bomblet_force 150
-set g_vehicle_raptor_bomblet_explode_delay 0.4
-set g_vehicle_raptor_bombs_refire 5
-
-set g_vehicle_raptor_cannon_turnspeed 120
-set g_vehicle_raptor_cannon_turnlimit 20
-set g_vehicle_raptor_cannon_pitchlimit_up 12
-set g_vehicle_raptor_cannon_pitchlimit_down 32
-
-set g_vehicle_raptor_cannon_locktarget 0
-set g_vehicle_raptor_cannon_locking_time 0.2
-set g_vehicle_raptor_cannon_locking_releasetime 0.45
-set g_vehicle_raptor_cannon_locked_time 1
-set g_vehicle_raptor_cannon_predicttarget 1
-
-set g_vehicle_raptor_cannon_cost 1
-set g_vehicle_raptor_cannon_damage 10
-set g_vehicle_raptor_cannon_radius 60
-set g_vehicle_raptor_cannon_refire 0.03
-set g_vehicle_raptor_cannon_speed 24000
-set g_vehicle_raptor_cannon_spread 0.01
-set g_vehicle_raptor_cannon_force 25
-
-set g_vehicle_raptor_flare_refire 5
-set g_vehicle_raptor_flare_lifetime 10
-set g_vehicle_raptor_flare_chase 0.9
-set g_vehicle_raptor_flare_range 2000
-
-set g_vehicle_raptor_energy 100
-set g_vehicle_raptor_energy_regen 25
-set g_vehicle_raptor_energy_regen_pause 0.25
-
-set g_vehicle_raptor_health 150
-set g_vehicle_raptor_health_regen 0
-set g_vehicle_raptor_health_regen_pause 0
-
-set g_vehicle_raptor_shield 75
-set g_vehicle_raptor_shield_regen 25
-set g_vehicle_raptor_shield_regen_pause 1.5
-
-set g_vehicle_raptor_blowup_radius 250
-set g_vehicle_raptor_blowup_coredamage 250
-set g_vehicle_raptor_blowup_edgedamage 15
-set g_vehicle_raptor_blowup_forceintensity 250
-
-set g_vehicle_raptor_bouncefactor 0.2
-set g_vehicle_raptor_bouncestop 0
-set g_vehicle_raptor_bouncepain "1 4 1000"
-
-set g_vehicle_raptor_mass 2200
+++ /dev/null
-set g_vehicle_spiderbot_respawntime 45
-
-set g_vehicle_spiderbot_health 800
-set g_vehicle_spiderbot_health_regen 10
-set g_vehicle_spiderbot_health_regen_pause 5
-
-set g_vehicle_spiderbot_shield 200
-set g_vehicle_spiderbot_shield_block 1
-set g_vehicle_spiderbot_shield_regen 25
-set g_vehicle_spiderbot_shield_regen_pause 0.35
-
-set g_vehicle_spiderbot_energy 0
-set g_vehicle_spiderbot_energy_regen 0
-set g_vehicle_spiderbot_energy_regen_pause 0
-
-set g_vehicle_spiderbot_turnspeed 90
-set g_vehicle_spiderbot_turnspeed_strafe 300
-set g_vehicle_spiderbot_head_turnspeed 110
-set g_vehicle_spiderbot_head_turnlimit 90
-set g_vehicle_spiderbot_head_pitchlimit_up 30
-set g_vehicle_spiderbot_head_pitchlimit_down -20
-
-set g_vehicle_spiderbot_speed_stop 50
-set g_vehicle_spiderbot_speed_walk 500
-set g_vehicle_spiderbot_speed_strafe 400
-set g_vehicle_spiderbot_movement_inertia 0.15
-set g_vehicle_spiderbot_tiltlimit 90
-
-set g_vehicle_spiderbot_minigun_damage 24 // 400 (x2) DPS
-set g_vehicle_spiderbot_minigun_refire 0.06
-set g_vehicle_spiderbot_minigun_force 9
-set g_vehicle_spiderbot_minigun_spread 0.015
-set g_vehicle_spiderbot_minigun_solidpenetration 32
-set g_vehicle_spiderbot_minigun_ammo_cost 1
-set g_vehicle_spiderbot_minigun_ammo_max 100
-set g_vehicle_spiderbot_minigun_ammo_regen 40
-set g_vehicle_spiderbot_minigun_ammo_regen_pause 1
-
-set g_vehicle_spiderbot_springlength 150
-set g_vehicle_spiderbot_springup 20
-set g_vehicle_spiderbot_springblend 0.1
-
-set g_vehicle_spiderbot_rocket_health 100
-set g_vehicle_spiderbot_rocket_damage 50
-set g_vehicle_spiderbot_rocket_edgedamage 25
-set g_vehicle_spiderbot_rocket_force 150
-set g_vehicle_spiderbot_rocket_radius 250
-set g_vehicle_spiderbot_rocket_reload 4
-set g_vehicle_spiderbot_rocket_refire 0.1
-set g_vehicle_spiderbot_rocket_refire2 0.025 // volly
-set g_vehicle_spiderbot_rocket_speed 3500
-set g_vehicle_spiderbot_rocket_turnrate 0.25
-set g_vehicle_spiderbot_rocket_noise 0.2
-set g_vehicle_spiderbot_rocket_lifetime 20
-set g_vehicle_spiderbot_rocket_spread 0.05
-
-set g_vehicle_spiderbot_blowup_radius 250
-set g_vehicle_spiderbot_blowup_coredamage 250
-set g_vehicle_spiderbot_blowup_edgedamage 15
-set g_vehicle_spiderbot_blowup_forceintensity 250
-
-set g_vehicle_spiderbot_bouncefactor 0 // Factor of old velocity to keep after colission
-set g_vehicle_spiderbot_bouncestop 0 // if != 0, New veloctiy after bounce = 0 if new velocity < this
-set g_vehicle_spiderbot_bouncepain "0 0 0" // "minspeed_for_pain speedchange_to_pain_factor max_damage"
+++ /dev/null
-set g_vehicles 1
-
-exec vehicle_racer.cfg
-exec vehicle_raptor.cfg
-exec vehicle_spiderbot.cfg
-exec vehicle_bumblebee.cfg
-
-set g_vehicle_racer 1
-set g_vehicle_spiderbot 1
-set g_vehicle_raptor 1
-set g_vehicle_bumblebee 1
-
-set g_vehicles_crush_dmg 70
-set g_vehicles_crush_force 50
-
-set cl_vehicles_hud_tactical 1
-set cl_vehicles_hudscale 0.5
-set cl_vehicles_crosshair_size 0.5
-
-set g_vehicles_enter 0 "require pressing use key to enter a vehicle"
-set g_vehicles_enter_radius 250
-set g_vehicles_steal 1 "allow stealing enemy vehicles in teamplay modes"
-set g_vehicles_steal_show_waypoint 1 "show a waypoint above the thief"
-
-set g_vehicles_teams 1 "allow team specific vehicles"
-
-set g_vehicles_delayspawn 1
-set g_vehicles_delayspawn_jitter 10
-
-set g_vehicles_vortex_damagerate 0.5
-set g_vehicles_machinegun_damagerate 0.65
-set g_vehicles_rifle_damagerate 1
-set g_vehicles_vaporizer_damagerate 0.8
-set g_vehicles_tag_damagerate 2
-