From 7cbe53e7c32effc9e041ab5105826b032e22a593 Mon Sep 17 00:00:00 2001 From: Bukz Date: Sun, 14 Aug 2011 22:02:37 +0000 Subject: [PATCH] compatibility stuff git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6572 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/compatibility.cfg | 11 +++++++++++ source/src/clientgame.cpp | 39 ++++++++++++++++++++++++++------------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/config/compatibility.cfg b/config/compatibility.cfg index 40eab538..e10c9209 100644 --- a/config/compatibility.cfg +++ b/config/compatibility.cfg @@ -1 +1,12 @@ // Makes old cubescripts compatible with newer versions of the game + +curmode = [ result $gamemode ] +getclientmode = [ result $gamemode ] + +curteam = [ if $numargs [ result (player $arg1 team) ] [ result (player1 team) ] ] + +pstat_score = [ + if (isclient $arg1) [ + result (concat (player $arg1 flags) (player $arg1 frags) (player $arg1 deaths) (player $arg1 points) (player $arg1 team) (player $arg1 tks) (findpn $arg1)) + ] [ result (concat "0 0 0 0 -1 0" (addpunct)) ] +] \ No newline at end of file diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 0bb2d479..4e9708c6 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -252,14 +252,21 @@ ICOMMANDF(skin_cla, ARG_1EST, (char *s) { return _setskin(s, TEAM_CLA); }); ICOMMANDF(skin_rvsf, ARG_1EST, (char *s) { return _setskin(s, TEAM_RVSF); }); ICOMMANDF(skin, ARG_1EST, (char *s) { return _setskin(s, player1->team); }); -int curteam() { return player1->team; } +void isclient(char *arg1) +{ + int i = atoi(arg1); + defformatstring(o)("%d", (getclient(i) != NULL || i == player1->clientnum) ? 1 : 0); + result(o); +} + +//int curteam() { return player1->team; } // See compatibility.cfg int isSpect() { return (player1->team==TEAM_SPECT || player1->spectatemode==SM_FLY); } int currole() { return player1->clientrole; } -int curmode() { return gamemode; } +//int curmode() { return gamemode; } // See compatibility.cfg int curmastermode() { return servstate.mastermode; } int curautoteam() { return servstate.autoteam; } void curmap(int cleaned) { result(cleaned ? behindpath(getclientmap()) : getclientmap()); } -void curplayers(void) { intret(multiplayer(false) ? (players.length() + 1) : players.length()); } +void curplayers() { intret(multiplayer(false) ? (players.length() + 1) : players.length()); } int curmodeattr(char *attr) { @@ -273,13 +280,14 @@ int curmodeattr(char *attr) COMMANDN(team, newteam, ARG_1STR); COMMANDN(name, newname, ARG_1STR); COMMAND(benchme, ARG_NONE); -COMMAND(curteam, ARG_IVAL); +//COMMAND(curteam, ARG_IVAL); +COMMAND(isclient, ARG_1STR); COMMAND(isSpect, ARG_IVAL); COMMAND(currole, ARG_IVAL); -COMMAND(curmode, ARG_IVAL); +//COMMAND(curmode, ARG_IVAL); COMMAND(curmastermode, ARG_IVAL); COMMAND(curautoteam, ARG_IVAL); -COMMAND(getclientmode, ARG_IVAL); +//COMMAND(getclientmode, ARG_IVAL); COMMAND(curmodeattr, ARG_1EST); COMMAND(curmap, ARG_1INT); COMMAND(curplayers, ARG_NONE); @@ -974,11 +982,12 @@ void dokill(playerent *pl, playerent *act, bool gib, int gun) pl->deaths++; audiomgr.playsound(S_DIE1+rnd(2), pl); } - +/* Removed in favor of the new (player) && (player1) commands ??? + See /config/compatibility.cfg void pstat_score(int cn) { - /*if(intermission) - {*/ + //if(intermission) + //{ string scorestring; int p_flags = 0; int p_frags = 0; @@ -996,10 +1005,11 @@ void pstat_score(int cn) } formatstring(scorestring)("%d %d %d %d %d %d %s", p_flags, p_frags, p_deaths, p_points, pl ? pl->team : -1, p_tks, pl ? pl->name : "\"\""); result(scorestring); - /*} - else result("0 0 0 0 -1 \"\"");*/ + //} + //else result("0 0 0 0 -1 \"\""); } COMMAND(pstat_score, ARG_1INT); +*/ void pstat_weap(int cn) { @@ -1642,8 +1652,11 @@ void setadmin(char *claim, char *password) else { int y = atoi(claim); - if((y != 1) && (player1->clientrole)) conoutf(_("you released admin status")); - if((y != 0) && (y != 1)) addmsg(SV_SETADMIN, "ris", 0); + if((y != 1) && (player1->clientrole)) + { + conoutf(_("you released admin status")); + addmsg(SV_SETADMIN, "ris", 0); + } else addmsg(SV_SETADMIN, "ris", y, genpwdhash(player1->name, password, sessionid)); }