*** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@823 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -60,13 +60,6 @@ void renderclients()
|
||||
playerent *d;
|
||||
loopv(players) if((d = players[i]) && (!demoplayback || i!=democlientnum))
|
||||
{
|
||||
#if 0
|
||||
if(strcmp(d->name, "dummy") == 0)
|
||||
{
|
||||
d->gunselect = player1->gunselect;
|
||||
d->health != 1 ? d->state=CS_ALIVE : d->state=CS_DEAD;
|
||||
};
|
||||
#endif
|
||||
renderplayer(d);
|
||||
};
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ extern vector<bounceent *> bounceents;
|
||||
extern bool editmode;
|
||||
extern vector<entity> ents; // map entities
|
||||
extern vec worldpos, camup, camright; // current target of the crosshair in the world
|
||||
extern vec hitpos;
|
||||
extern int lastmillis; // last time
|
||||
extern int curtime; // current frame time
|
||||
extern int gamemode, nextmode;
|
||||
|
||||
+1
-1
@@ -196,7 +196,7 @@ extern void linestyle(float width, int r, int g, int b);
|
||||
extern void newsphere(vec &o, float max, int type);
|
||||
extern void renderspheres(int time);
|
||||
extern void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwater);
|
||||
extern void readdepth(int w, int h);
|
||||
extern void readdepth(int w, int h, vec &pos = worldpos);
|
||||
extern void blendbox(int x1, int y1, int x2, int y2, bool border, int tex = -1);
|
||||
extern void damageblend(int n);
|
||||
extern void addshotline(dynent *d, vec &from, vec &to);
|
||||
|
||||
@@ -246,14 +246,14 @@ float depthcorrect(float d)
|
||||
// also hits map entities which is unwanted.
|
||||
// could be replaced by a more acurate version of monster.cpp los() if needed
|
||||
|
||||
void readdepth(int w, int h)
|
||||
void readdepth(int w, int h, vec &pos)
|
||||
{
|
||||
glReadPixels(w/2, h/2, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &cursordepth);
|
||||
double worldx = 0, worldy = 0, worldz = 0;
|
||||
gluUnProject(w/2, h/2, depthcorrect(cursordepth), mm, pm, viewport, &worldx, &worldz, &worldy);
|
||||
worldpos.x = (float)worldx;
|
||||
worldpos.y = (float)worldy;
|
||||
worldpos.z = (float)worldz;
|
||||
pos.x = (float)worldx;
|
||||
pos.y = (float)worldy;
|
||||
pos.z = (float)worldz;
|
||||
};
|
||||
|
||||
void drawicon(float tx, float ty, int x, int y, Texture *tex = NULL, float scaling = 1/3.0f) // EDIT: AH
|
||||
|
||||
@@ -418,6 +418,8 @@ void gl_drawframe(int w, int h, float changelod, float curfps)
|
||||
|
||||
renderclients();
|
||||
|
||||
if(player1->state==CS_ALIVE) readdepth(w, h, hitpos);
|
||||
|
||||
renderspheres(curtime);
|
||||
renderents();
|
||||
|
||||
|
||||
@@ -463,6 +463,9 @@ void shorten(vec &from, vec &to, vec &target)
|
||||
target.sub(from).normalize().mul(from.dist(to)).add(from);
|
||||
};
|
||||
|
||||
const float HEADSIZE = 0.8f;
|
||||
vec hitpos;
|
||||
|
||||
void raydamage(vec &from, vec &to, playerent *d)
|
||||
{
|
||||
int i = -1, gdam = guns[d->gunselect].damage;
|
||||
@@ -495,10 +498,10 @@ void raydamage(vec &from, vec &to, playerent *d)
|
||||
}
|
||||
else if((o = intersectclosest(from, to, i, d)))
|
||||
{
|
||||
playerent head = *o; // check headshot
|
||||
head.eyeheight = head.aboveeye/4;
|
||||
head.radius = 2;
|
||||
if(d->gunselect == GUN_SNIPER && intersect(&head, from, to)) gdam = guns[d->gunselect].damage * 3;
|
||||
if(d==player1 && d->gunselect==GUN_SNIPER
|
||||
&& worldpos!=hitpos && hitpos.z>=o->o.z+o->aboveeye-HEADSIZE
|
||||
&& intersect(o, from, hitpos))
|
||||
gdam *= 3;
|
||||
|
||||
hitpush(i, gdam, o, d, from, to);
|
||||
shorten(from, o->o, to);
|
||||
|
||||
Reference in New Issue
Block a user