From f98189c65ab0c5d9471b888964068c24f621ea6f Mon Sep 17 00:00:00 2001 From: driAn Date: Fri, 14 Oct 2005 19:06:05 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@40 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 1 + source/src/main.cpp | 5 ++-- source/src/protos.h | 5 +++- source/src/renderextras.cpp | 46 ++++++++++++++++++++++++++++++++ source/src/rendergl.cpp | 7 +++-- source/src/rendermd2.cpp | 2 +- source/src/renderparticles.cpp | 3 ++- source/src/weapon.cpp | 48 +++++++++++++++++++++++++++------- 8 files changed, 100 insertions(+), 17 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 90ed518b..9d84876f 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -535,6 +535,7 @@ void startmap(char *name) // called just after a map load sleepwait = 0; //put call to clear/restart game mode extras here projreset(); + shotlinereset(); spawncycle = -1; spawnplayer(player1); player1->frags = 0; diff --git a/source/src/main.cpp b/source/src/main.cpp index 1ef6b607..1c3bd3b1 100644 --- a/source/src/main.cpp +++ b/source/src/main.cpp @@ -41,9 +41,6 @@ void *alloc(int s) // for some big chunks... most other allocs use return b; }; -int minfps = 32; -int maxfps = 40; - int scr_w = 640; int scr_h = 480; @@ -73,6 +70,8 @@ void screenshot() COMMAND(screenshot, ARG_NONE); COMMAND(quit, ARG_NONE); + +int minfps, maxfps; void fpsrange(int low, int high) { diff --git a/source/src/protos.h b/source/src/protos.h index 4000ae42..72ccbce7 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -159,7 +159,10 @@ 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 blendbox(int x1, int y1, int x2, int y2, bool border); -extern void damageblend(int n); +extern void damageblend(int n); +extern void addshotline(vec &from, vec &to); +extern void rendershotlines(); +extern void shotlinereset(); // renderparticles extern void setorient(vec &r, vec &u); diff --git a/source/src/renderextras.cpp b/source/src/renderextras.cpp index bbc4dc84..1f9e82e1 100644 --- a/source/src/renderextras.cpp +++ b/source/src/renderextras.cpp @@ -388,5 +388,51 @@ void gl_drawhud(int w, int h, int curfps, int nquads, int curvert, bool underwat glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glEnable(GL_DEPTH_TEST); +}; + +#define MAXSHOTLINES 100 +struct shotline +{ + vec from, to; + bool inuse; + int millis; +}; +shotline shotlines[MAXSHOTLINES]; + +void shotlinereset() { loopi(MAXSHOTLINES) shotlines[i].inuse = false; }; + +void addshotline(vec &from, vec &to) +{ + loopi(MAXSHOTLINES) + { + shotline *s = &shotlines[i]; + if(s->inuse) continue; + s->inuse = true; + s->from = from; + s->to = to; + s->millis = lastmillis; + return; + }; +}; + +void rendershotlines() +{ + return; + loopi(MAXSHOTLINES) + { + shotline *s = &shotlines[i]; + if(!s->inuse) continue; + //if(lastmillis-s->millis > 1000) { s->inuse = false; continue; } + glPushMatrix(); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + glDisable(GL_BLEND); + glBegin(GL_LINES); + glVertex3f(s->to.x, s->to.y, s->to.z); + glVertex3f(s->from.x, s->from.y, s->from.z); + glEnd(); + glEnable(GL_BLEND); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + glPopMatrix(); + }; }; diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 3feb25c8..f6fd82aa 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -340,7 +340,8 @@ void gl_drawframe(int w, int h, float changelod, float curfps) renderstripssky(); - glLoadIdentity(); + glLoadIdentity(); + glRotated(player1->pitch, -1.0, 0.0, 0.0); glRotated(player1->yaw, 0.0, 1.0, 0.0); glRotated(90.0, 1.0, 0.0, 0.0); @@ -364,7 +365,9 @@ void gl_drawframe(int w, int h, float changelod, float curfps) renderentities(); renderspheres(curtime); - renderents(); + renderents(); + + rendershotlines(); glDisable(GL_CULL_FACE); diff --git a/source/src/rendermd2.cpp b/source/src/rendermd2.cpp index 09e5ada0..a868847e 100644 --- a/source/src/rendermd2.cpp +++ b/source/src/rendermd2.cpp @@ -125,7 +125,7 @@ void md2::scale(int frame, float scale, int sn) void md2::render(vec &light, int frame, int range, float x, float y, float z, float yaw, float pitch, float sc, float speed, int snap, int basetime) { - loopi(range) if(!mverts[frame+i]) scale(frame+i, sc, snap); + loopi(range) if(!mverts[frame+i]) scale(frame+i, sc, snap); glPushMatrix (); glTranslatef(x, y, z); diff --git a/source/src/renderparticles.cpp b/source/src/renderparticles.cpp index ab90a0ad..4c498b37 100644 --- a/source/src/renderparticles.cpp +++ b/source/src/renderparticles.cpp @@ -125,7 +125,7 @@ void particle_splash(int type, int num, int fade, vec &p) vec d = { (float)x, (float)y, (float)z }; newparticle(p, d, rnd(fade*3), type); }; -}; +}; void particle_trail(int type, int fade, vec &s, vec &e) { @@ -139,4 +139,5 @@ void particle_trail(int type, int fade, vec &s, vec &e) newparticle(p, d, rnd(fade)+fade, type); }; }; + diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index ca6349d8..800c0ab9 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -6,25 +6,53 @@ struct guninfo { short sound, reload, reloadtime, attackdelay, damage, projspee const int SGRAYS = 20; //down from 20 (defualt) const float SGSPREAD = 2; -vec sg[SGRAYS]; +vec sg[SGRAYS]; + +//FIXME!!! +VAR(pistol_rot, 0, 6, 100); VAR(pistol_back, 0, 5, 100); +VAR(shotgun_rot, 0, 10, 100); VAR(shotgun_back, 0, 10, 100); +VAR(subgun_rot, 0, 3, 100); VAR(subgun_back, 0, 2, 100); +VAR(sniper_rot, 0, 3, 100); VAR(sniper_back, 0, 2, 100); +VAR(assult_rot, 0, 4, 100); VAR(assult_back, 0, 2, 100); //change the particales guninfo guns[NUMGUNS] = { { S_KNIFE, S_NULL, 0, 250, 50, 0, 0, 1, 1, 1, 0, 0, "knife" }, - { S_PISTOL, S_RPISTOL, 1400, 170, 20, 0, 0, 20, 10, 8, 6, 5, "pistol" }, // *SGRAYS + { S_PISTOL, S_RPISTOL, 1400, 170, 20, 0, 0, 20, 10, 8, pistol_rot, pistol_back, "pistol" }, // *SGRAYS - { S_SHOTGUN, S_RSHOTGUN, 2400, 1100, 6, 0, 0, 1, 35, 7, 10, 10, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6 + { S_SHOTGUN, S_RSHOTGUN, 2400, 1100, 6, 0, 0, 1, 35, 7, shotgun_rot, shotgun_back, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6 - { S_SUBGUN, S_RSUBGUN, 1650, 90, 14, 0, 0, 45, 15, 30, 3, 2, "subgun" }, + { S_SUBGUN, S_RSUBGUN, 1650, 90, 14, 0, 0, 45, 15, 30, subgun_rot, subgun_back, "subgun" }, - { S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, 3, 2, "sniper" }, + { S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, sniper_rot, sniper_back, "sniper" }, - { S_ASSULT, S_RASSULT, 2000, 130, 33, 0, 0, 90, 40, 20, 4, 2, "assult" }, //recoil was 44 + { S_ASSULT, S_RASSULT, 2000, 130, 33, 0, 0, 90, 40, 20, assult_rot, assult_back, "assult" }, //recoil was 44 { S_GRENADE, S_NULL, 0, 2000, 40, 30, 6, 1, 1, 1, 3, 1, "grenade" }, -}; +}; + +void updatekickback() { +guninfo tmp[NUMGUNS] = +{ + { S_KNIFE, S_NULL, 0, 250, 50, 0, 0, 1, 1, 1, 0, 0, "knife" }, + + { S_PISTOL, S_RPISTOL, 1400, 170, 20, 0, 0, 20, 10, 8, pistol_rot, pistol_back, "pistol" }, // *SGRAYS + + { S_SHOTGUN, S_RSHOTGUN, 2400, 1100, 6, 0, 0, 1, 35, 7, shotgun_rot, shotgun_back, "shotgun" }, //reload time is for 1 shell from 7 too powerful to 6 + + { S_SUBGUN, S_RSUBGUN, 1650, 90, 14, 0, 0, 45, 15, 30, subgun_rot, subgun_back, "subgun" }, + + { S_SNIPER, S_RSNIPER, 1950, 1500, 72, 0, 0, 60, 50, 5, sniper_rot, sniper_back, "sniper" }, + + { S_ASSULT, S_RASSULT, 2000, 130, 33, 0, 0, 90, 40, 20, assult_rot, assult_back, "assult" }, //recoil was 44 + + { S_GRENADE, S_NULL, 0, 2000, 40, 30, 6, 1, 1, 1, 3, 1, "grenade" }, +}; +guns=tmp; +};COMMAND(updatekickback, ARG_NONE); + //weapon selection void wup() @@ -317,7 +345,8 @@ void shootv(int gun, vec &from, vec &to, dynent *d, bool local) // create vi case GUN_PISTOL: case GUN_SUBGUN: - case GUN_ASSULT: + case GUN_ASSULT: + addshotline(from, to); particle_splash(0, 100, 250, to); //particle_trail(1, 10, from, to); break; @@ -328,7 +357,8 @@ void shootv(int gun, vec &from, vec &to, dynent *d, bool local) // create vi conoutf("NADE"); break; - case GUN_SNIPER: + case GUN_SNIPER: + addshotline(from, to); particle_splash(0, 50, 200, to); particle_trail(1, 500, from, to); break;