Skip to content

Commit

Permalink
use Travis CI for Linux and AppVeyor for Windows builds
Browse files Browse the repository at this point in the history
for tagged commits, sauerbraten.exe and linux_64_client are uploaded to a GitHub release
  • Loading branch information
sauerbraten committed Nov 24, 2020
1 parent 050869d commit 2428aec
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 59 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
os: linux
dist: bionic
language: cpp
compiler: clang
before_install: sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-image-dev zlib1g-dev binutils
script:
- cd src
- make client
- strip sauer_client
- cd ..
before_deploy:
- mv src/sauer_client linux_64_client
deploy:
provider: releases
api_key:
secure: "UaYEZk+Ve/Nn5fYhwors1dF3DjIxkVayuZmft8XFKhcResZO6yvQ+jeG6xpK4MgdFJ0GBdcXF1vkky7JkxioHQsVPl84a/NNH+eJysKlqRjABuOH4w7BaALZh0wWG2rOINOIvLZl0Pboj1MzvK4IA8CI1tEAZWkq/1ggDYycaObJvJjfa3vmikGQxw12abmIcEwIFn39CpakyIiq5erhypWZo46r46u1VNgy7eXNHg5FjgSD7UQRjns1uCC2NK85/ZPUiup69c2zdQzntNyFvlLgRQU/u82J0lLySalj2X+KjG5XnzKDkxV1s4QSidp6IFCyKOVBHsoRpnB80QgXdWSY+OO9yfCUuqzX31HQRksDTJ5JO5AKEV4l2RN/6sPFA9mKgs8OZx0Fq/MYvDhH1DWWHNiK6ufDyK9yUnACfxW5O5C5AabtiaS8IiIhXvW0kbv9O1tZXMbMCNIf8KwghP1o35NgyP/jvTk1V/BCzs0aqj5goiUgFUcmltlFS0toEnIjZJnXlxCNsbs3cpTPZDCCMiH63RUM+ZirOF0ADeUCoTK43eAV/m3p7yT5TfSodvlyMJLxZ37MIcrLlLwVB+bsUAu4ddgFPwXQatH++axsEHMfLxGedBdjpFcb1y+PM6ZQK8ZpopaVwwKDo/DcmP1/Ww0WMIwRwTM6iIZLZmg="
file: 'linux_64_client'
skip_cleanup: true
overwrite: true
on:
tags: true
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ clean-sauer: check-env

purge: uninstall undo-patches clean-sauer

update-src: check-env clean-sauer
update-src: build clean-sauer
rm --recursive --force src/
rsync --recursive --times --exclude=".*" $(SAUER_DIR)/src .

Expand Down
15 changes: 15 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 1.0.{build}
configuration: Release
platform: x64
build:
project: src/vcpp/sauerbraten.vcxproj
verbosity: minimal
artifacts:
- path: bin64/sauerbraten.exe
deploy:
- provider: GitHub
auth_token:
secure: CFYvYuxU2ihMXihnUfV4covPTRzzKgbgVk/I+ZEqVu39uLIJlMAGqhNXfGm1BNEv
force_update: true
on:
APPVEYOR_REPO_TAG: true
58 changes: 29 additions & 29 deletions patches/004_weaponstats.patch
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Index: src/fpsgame/client.cpp
s->lastaction = lastmillis;
s->lastattackgun = s->gunselect;
shoteffects(s->gunselect, from, to, s, false, id, prevaction);
+ recordshot(s);
+ recordpotentialdamage(s);
break;
}

Expand All @@ -75,7 +75,7 @@ Index: src/fpsgame/fps.cpp
{
if((d->state!=CS_ALIVE && d->state != CS_LAGGED && d->state != CS_SPAWNING) || intermission) return;

+ recordhit(actor, d, damage);
+ recorddamage(actor, d, damage);
+
if(local) damage = d->dodamage(damage);
else if(actor==player1) return;
Expand All @@ -87,8 +87,8 @@ Index: src/fpsgame/fps.cpp
- ICOMMAND(getaccuracy, "", (), intret((player1->totaldamage*100)/max(player1->totalshots, 1)));
- ICOMMAND(gettotaldamage, "", (), intret(player1->totaldamage));
- ICOMMAND(gettotalshots, "", (), intret(player1->totalshots));
+ ICOMMAND(gettotaldamage, "", (), intret(damage(player1, DMG_DEALT)));
+ ICOMMAND(gettotalshots, "", (), intret(damage(player1, DMG_POTENTIAL)));
+ ICOMMAND(gettotaldamage, "", (), intret(playerdamage(player1, DMG_DEALT)));
+ ICOMMAND(gettotalshots, "", (), intret(playerdamage(player1, DMG_POTENTIAL)));

vector<fpsent *> clients;

Expand Down Expand Up @@ -145,7 +145,7 @@ Index: src/fpsgame/weapon.cpp
d->gunwait = guns[d->gunselect].attackdelay;
if(d->gunselect == GUN_PISTOL && d->ai) d->gunwait += int(d->gunwait*(((101-d->skill)+rnd(111-d->skill))/100.f));
d->totalshots += guns[d->gunselect].damage*(d->quadmillis ? 4 : 1)*guns[d->gunselect].rays;
+ recordshot(d);
+ recordpotentialdamage(d);
}

void adddynlights()
Expand All @@ -157,22 +157,22 @@ Index: src/fpsgame/weaponstats.cpp
+#include "game.h"
+
+namespace game {
+ void recordshot(fpsent *shooter)
+ void recordpotentialdamage(fpsent *shooter)
+ {
+ if(!shooter) return;
+ int gun = shooter->gunselect;
+ int potentialdamage = guns[gun].damage * (shooter->quadmillis ? 4 : 1 ) * guns[gun].rays;
+ shooter->stats.add(DMG_POTENTIAL, gun, potentialdamage);
+ }
+
+ bool shouldcounthit(fpsent *attacker, fpsent *target)
+ bool shouldcountdamage(fpsent *attacker, fpsent *target)
+ {
+ return (attacker != target) && !isteam(attacker->team, target->team);
+ }
+
+ void recordhit(fpsent *attacker, fpsent *target, int damage)
+ void recorddamage(fpsent *attacker, fpsent *target, int damage)
+ {
+ if(!shouldcounthit(attacker, target)) return;
+ if(!shouldcountdamage(attacker, target)) return;
+ int gun = attacker->gunselect;
+ // try to fix gun used to deal the damage
+ if(gun == GUN_RL || gun == GUN_GL || damage != guns[gun].damage * (attacker->quadmillis ? 4 : 1))
Expand All @@ -189,35 +189,35 @@ Index: src/fpsgame/weaponstats.cpp
+ return ret;\
+ })
+
+ int damage(fpsent *p, int typ, int gun)
+ int playerdamage(fpsent *p, int typ, int gun)
+ {
+ if(!p) p = hudplayer();
+ return p->stats.get(typ, gun);
+ }
+ DMG_ICOMMAND(getdamagepotential, intret(damage(p, DMG_POTENTIAL, gun)))
+ DMG_ICOMMAND(getdamagedealt, intret(damage(p, DMG_DEALT, gun)))
+ DMG_ICOMMAND(getdamagereceived, intret(damage(p, DMG_RECEIVED, gun)))
+ DMG_ICOMMAND(getdamagepotential, intret(playerdamage(p, DMG_POTENTIAL, gun)))
+ DMG_ICOMMAND(getdamagedealt, intret(playerdamage(p, DMG_DEALT, gun)))
+ DMG_ICOMMAND(getdamagereceived, intret(playerdamage(p, DMG_RECEIVED, gun)))
+
+ int damagewasted(fpsent *p, int gun)
+ int playerdamagewasted(fpsent *p, int gun)
+ {
+ if(!p) p = hudplayer();
+ return p->stats.wasted(gun);
+ }
+ DMG_ICOMMAND(getdamagewasted, intret(damagewasted(p, gun)))
+ DMG_ICOMMAND(getdamagewasted, intret(playerdamagewasted(p, gun)))
+
+ int netdamage(fpsent *p, int gun)
+ int playernetdamage(fpsent *p, int gun)
+ {
+ if(!p) p = hudplayer();
+ return p->stats.net(gun);
+ }
+ DMG_ICOMMAND(getnetdamage, intret(netdamage(p, gun)))
+ DMG_ICOMMAND(getnetdamage, intret(playernetdamage(p, gun)))
+
+ float accuracy(fpsent *p, int gun)
+ float playeraccuracy(fpsent *p, int gun)
+ {
+ if(!p) p = hudplayer();
+ return p->stats.accuracy(gun);
+ }
+ DMG_ICOMMAND(getaccuracy, floatret(accuracy(p, gun)))
+ DMG_ICOMMAND(getaccuracy, floatret(playeraccuracy(p, gun)))
+}
Index: src/fpsgame/weaponstats.h
===================================================================
Expand All @@ -228,13 +228,13 @@ Index: src/fpsgame/weaponstats.h
+#define __WEAPONSTATS_H__
+
+namespace game {
+ extern void recordshot(fpsent *shooter);
+ extern bool shouldcounthit(fpsent *attacker, fpsent *target);
+ extern void recordhit(fpsent *attacker, fpsent *target, int damage);
+ extern int damage(fpsent *p, int typ, int gun = -1);
+ extern int damagewasted(fpsent *p, int gun = -1);
+ extern int netdamage(fpsent *p, int gun = -1);
+ extern float accuracy(fpsent *p, int gun = -1);
+ extern void recordpotentialdamage(fpsent *shooter);
+ extern bool shouldcountdamage(fpsent *attacker, fpsent *target);
+ extern void recorddamage(fpsent *attacker, fpsent *target, int damage);
+ extern int playerdamage(fpsent *p, int typ, int gun = -1);
+ extern int playerdamagewasted(fpsent *p, int gun = -1);
+ extern int playernetdamage(fpsent *p, int gun = -1);
+ extern float playeraccuracy(fpsent *p, int gun = -1);
+}
+
+#endif
Expand Down Expand Up @@ -334,7 +334,7 @@ Index: src/fpsgame/scoreboard.cpp
+ g.pushlist();
+ g.strut(5);
+ g.text("acc", fgcolor);
+ loopscoregroup(o, g.textf("%.0f%%", 0xFFFFDD, NULL, accuracy(o)));
+ loopscoregroup(o, g.textf("%.0f%%", 0xFFFFDD, NULL, playeraccuracy(o)));
+ g.poplist();
+ }
+
Expand All @@ -344,9 +344,9 @@ Index: src/fpsgame/scoreboard.cpp
+ g.strut(6);
+ g.text("dd", fgcolor);
+ loopscoregroup(o, {
+ float dmg = (float) showdamage == 1 ? damage(o, DMG_DEALT) : netdamage(o);
+ float dmg = (float) showdamage == 1 ? playerdamage(o, DMG_DEALT) : playernetdamage(o);
+ const char *fmt = "%.0f";
+ if(abs(dmg) > 1000.0f) { fmt = "%.1fk"; dmg = dmg/1000.0f; }
+ if(fabs(dmg) > 1000.0f) { fmt = "%.1fk"; dmg = dmg/1000.0f; }
+ g.textf(fmt, 0xFFFFDD, NULL, dmg);
+ });
+ g.poplist();
Expand Down
2 changes: 1 addition & 1 deletion src/fpsgame/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,7 @@ namespace game
s->lastaction = lastmillis;
s->lastattackgun = s->gunselect;
shoteffects(s->gunselect, from, to, s, false, id, prevaction);
recordshot(s);
recordpotentialdamage(s);
break;
}

Expand Down
6 changes: 3 additions & 3 deletions src/fpsgame/fps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ namespace game
{
if((d->state!=CS_ALIVE && d->state != CS_LAGGED && d->state != CS_SPAWNING) || intermission) return;

recordhit(actor, d, damage);
recorddamage(actor, d, damage);

if(local) damage = d->dodamage(damage);
else if(actor==player1) return;
Expand Down Expand Up @@ -533,8 +533,8 @@ namespace game
ICOMMAND(getfrags, "", (), intret(player1->frags));
ICOMMAND(getflags, "", (), intret(player1->flags));
ICOMMAND(getdeaths, "", (), intret(player1->deaths));
ICOMMAND(gettotaldamage, "", (), intret(damage(player1, DMG_DEALT)));
ICOMMAND(gettotalshots, "", (), intret(damage(player1, DMG_POTENTIAL)));
ICOMMAND(gettotaldamage, "", (), intret(playerdamage(player1, DMG_DEALT)));
ICOMMAND(gettotalshots, "", (), intret(playerdamage(player1, DMG_POTENTIAL)));

vector<fpsent *> clients;

Expand Down
6 changes: 3 additions & 3 deletions src/fpsgame/scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ namespace game
g.pushlist();
g.strut(5);
g.text("acc", fgcolor);
loopscoregroup(o, g.textf("%.0f%%", 0xFFFFDD, NULL, accuracy(o)));
loopscoregroup(o, g.textf("%.0f%%", 0xFFFFDD, NULL, playeraccuracy(o)));
g.poplist();
}

Expand All @@ -285,9 +285,9 @@ namespace game
g.strut(6);
g.text("dd", fgcolor);
loopscoregroup(o, {
float dmg = (float) showdamage == 1 ? damage(o, DMG_DEALT) : netdamage(o);
float dmg = (float) showdamage == 1 ? playerdamage(o, DMG_DEALT) : playernetdamage(o);
const char *fmt = "%.0f";
if(abs(dmg) > 1000.0f) { fmt = "%.1fk"; dmg = dmg/1000.0f; }
if(fabs(dmg) > 1000.0f) { fmt = "%.1fk"; dmg = dmg/1000.0f; }
g.textf(fmt, 0xFFFFDD, NULL, dmg);
});
g.poplist();
Expand Down
2 changes: 1 addition & 1 deletion src/fpsgame/weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ namespace game
d->gunwait = guns[d->gunselect].attackdelay;
if(d->gunselect == GUN_PISTOL && d->ai) d->gunwait += int(d->gunwait*(((101-d->skill)+rnd(111-d->skill))/100.f));
d->totalshots += guns[d->gunselect].damage*(d->quadmillis ? 4 : 1)*guns[d->gunselect].rays;
recordshot(d);
recordpotentialdamage(d);
}

void adddynlights()
Expand Down
28 changes: 14 additions & 14 deletions src/fpsgame/weaponstats.cpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
#include "game.h"

namespace game {
void recordshot(fpsent *shooter)
void recordpotentialdamage(fpsent *shooter)
{
if(!shooter) return;
int gun = shooter->gunselect;
int potentialdamage = guns[gun].damage * (shooter->quadmillis ? 4 : 1 ) * guns[gun].rays;
shooter->stats.add(DMG_POTENTIAL, gun, potentialdamage);
}

bool shouldcounthit(fpsent *attacker, fpsent *target)
bool shouldcountdamage(fpsent *attacker, fpsent *target)
{
return (attacker != target) && !isteam(attacker->team, target->team);
}

void recordhit(fpsent *attacker, fpsent *target, int damage)
void recorddamage(fpsent *attacker, fpsent *target, int damage)
{
if(!shouldcounthit(attacker, target)) return;
if(!shouldcountdamage(attacker, target)) return;
int gun = attacker->gunselect;
// try to fix gun used to deal the damage
if(gun == GUN_RL || gun == GUN_GL || damage != guns[gun].damage * (attacker->quadmillis ? 4 : 1))
Expand All @@ -33,33 +33,33 @@ namespace game {
return ret;\
})

int damage(fpsent *p, int typ, int gun)
int playerdamage(fpsent *p, int typ, int gun)
{
if(!p) p = hudplayer();
return p->stats.get(typ, gun);
}
DMG_ICOMMAND(getdamagepotential, intret(damage(p, DMG_POTENTIAL, gun)))
DMG_ICOMMAND(getdamagedealt, intret(damage(p, DMG_DEALT, gun)))
DMG_ICOMMAND(getdamagereceived, intret(damage(p, DMG_RECEIVED, gun)))
DMG_ICOMMAND(getdamagepotential, intret(playerdamage(p, DMG_POTENTIAL, gun)))
DMG_ICOMMAND(getdamagedealt, intret(playerdamage(p, DMG_DEALT, gun)))
DMG_ICOMMAND(getdamagereceived, intret(playerdamage(p, DMG_RECEIVED, gun)))

int damagewasted(fpsent *p, int gun)
int playerdamagewasted(fpsent *p, int gun)
{
if(!p) p = hudplayer();
return p->stats.wasted(gun);
}
DMG_ICOMMAND(getdamagewasted, intret(damagewasted(p, gun)))
DMG_ICOMMAND(getdamagewasted, intret(playerdamagewasted(p, gun)))

int netdamage(fpsent *p, int gun)
int playernetdamage(fpsent *p, int gun)
{
if(!p) p = hudplayer();
return p->stats.net(gun);
}
DMG_ICOMMAND(getnetdamage, intret(netdamage(p, gun)))
DMG_ICOMMAND(getnetdamage, intret(playernetdamage(p, gun)))

float accuracy(fpsent *p, int gun)
float playeraccuracy(fpsent *p, int gun)
{
if(!p) p = hudplayer();
return p->stats.accuracy(gun);
}
DMG_ICOMMAND(getaccuracy, floatret(accuracy(p, gun)))
DMG_ICOMMAND(getaccuracy, floatret(playeraccuracy(p, gun)))
}
14 changes: 7 additions & 7 deletions src/fpsgame/weaponstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#define __WEAPONSTATS_H__

namespace game {
extern void recordshot(fpsent *shooter);
extern bool shouldcounthit(fpsent *attacker, fpsent *target);
extern void recordhit(fpsent *attacker, fpsent *target, int damage);
extern int damage(fpsent *p, int typ, int gun = -1);
extern int damagewasted(fpsent *p, int gun = -1);
extern int netdamage(fpsent *p, int gun = -1);
extern float accuracy(fpsent *p, int gun = -1);
extern void recordpotentialdamage(fpsent *shooter);
extern bool shouldcountdamage(fpsent *attacker, fpsent *target);
extern void recorddamage(fpsent *attacker, fpsent *target, int damage);
extern int playerdamage(fpsent *p, int typ, int gun = -1);
extern int playerdamagewasted(fpsent *p, int gun = -1);
extern int playernetdamage(fpsent *p, int gun = -1);
extern float playeraccuracy(fpsent *p, int gun = -1);
}

#endif
14 changes: 14 additions & 0 deletions src/vcpp/sauerbraten.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,20 @@
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<ClCompile Include="..\fpsgame\weaponstats.cpp">
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">game.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">game.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">game.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">game.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">game.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">game.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)game.pch</PrecompiledHeaderOutputFile>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="sauerbraten.rc" />
Expand Down

0 comments on commit 2428aec

Please sign in to comment.