Skip to content

Commit

Permalink
Added shots / hits incrementing (fixes accuracy)
Browse files Browse the repository at this point in the history
  • Loading branch information
greghaynes committed Jul 21, 2010
1 parent cca2f7d commit cd689af
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
9 changes: 4 additions & 5 deletions src/fpsgame/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,11 +1120,6 @@ namespace server
gamelimit = gamemillis + (mins * 60000) + 1;
}

void endgame()
{
setgamemins(0);
}

void checkintermission()
{
if(gamemillis >= gamelimit && !interm)
Expand Down Expand Up @@ -1216,6 +1211,7 @@ namespace server
return;
}
sendf(-1, 1, "ri4x", N_EXPLODEFX, ci->clientnum, gun, id, ci->ownernum);
gs.shots++;
loopv(hits)
{
hitinfo &h = hits[i];
Expand All @@ -1226,6 +1222,7 @@ namespace server
loopj(i) if(hits[j].target==h.target) { dup = true; break; }
if(dup) continue;

gs.hits++;
int damage = guns[gun].damage;
if(gs.quadmillis) damage *= 4;
damage = int(damage*(1-h.dist/RL_DISTSCALE/RL_DAMRAD));
Expand All @@ -1251,6 +1248,7 @@ namespace server
int(to.x*DMF), int(to.y*DMF), int(to.z*DMF),
ci->ownernum);
gs.shotdamage += guns[gun].damage*(gs.quadmillis ? 4 : 1)*(gun==GUN_SG ? SGRAYS : 1);
gs.shots++;
switch(gun)
{
case GUN_RL: gs.rockets.add(id); break;
Expand All @@ -1264,6 +1262,7 @@ namespace server
clientinfo *target = getinfo(h.target);
if(!target || target->state.state!=CS_ALIVE || h.lifesequence!=target->state.lifesequence || h.rays<1 || h.dist > guns[gun].range + 1) continue;

gs.hits++;
totalrays += h.rays;
if(totalrays>maxrays) continue;
int damage = h.rays*guns[gun].damage;
Expand Down
1 change: 0 additions & 1 deletion src/fpsgame/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ namespace server
bool pregame_setteam(clientinfo *, char *);
bool spectate(clientinfo *, bool, int);
void setgamemins(int mins);
void endgame();
void resetpriv(clientinfo *ci);
void sendmapreload();
void senddemo(int cn, int num);
Expand Down
11 changes: 2 additions & 9 deletions src/pycontrol/servermodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,13 +752,6 @@ static PyObject *setGameMins(PyObject *self, PyObject *args)
return Py_None;
}

static PyObject *endGame(PyObject *self, PyObject *args)
{
server::endgame();
Py_INCREF(Py_None);
return Py_None;
}

static PyObject *adminPass(PyObject *self, PyObject *args)
{
return Py_BuildValue("s", server::adminpass);
Expand Down Expand Up @@ -959,7 +952,6 @@ static PyMethodDef ModuleMethods[] = {
{"port", port, METH_VARARGS, "Current server port."},
{"authChallenge", authChal, METH_VARARGS, "Send auth challenge to client."},
{"setMinsRemaining", setGameMins, METH_VARARGS, "Set the minutes remanining in current game."},
{"endGame", endGame, METH_VARARGS, "End the current game."},
{"adminPassword", adminPass, METH_VARARGS, "Get the administrator password."},
{"publicServer", publicServer, METH_VARARGS, "Decides how masters are chosen and what privileges they have."},
{"sendMapReload", sendMapReload, METH_VARARGS, "Causes all users to send vote on next map."},
Expand All @@ -971,9 +963,10 @@ static PyMethodDef ModuleMethods[] = {
{"nextMatchRecorded", nextMatchRecorded, METH_VARARGS, "Is next match being recorded."},
{"setRecordNextMatch", setRecordNextMatch, METH_VARARGS, "Set to record demo of next match."},
{"demoSize", demoSize, METH_VARARGS, "Size of demo in bytes."},
{"demoData", demoData, METH_VARARGS, "Demo data."},
{"demoData", demoData, METH_VARARGS, "Demo data."},
{"sendDemo", sendDemo, METH_VARARGS, "Send demo to client."},
{"suicide", suicide, METH_VARARGS, "Force client to commit suicide."},
{"configdir", configdir, METH_VARARGS, "Python config dir."},
{NULL, NULL, 0, NULL}
};

Expand Down

0 comments on commit cd689af

Please sign in to comment.