map overview spectate mode ?

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6425 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lucas GAUTHERON
2011-05-14 12:12:28 +00:00
parent 414572e574
commit d3c8df87bf
3 changed files with 35 additions and 3 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ static inline const char *team_string(int t, bool abbr = false) { const char **n
enum { ENT_PLAYER = 0, ENT_BOT, ENT_CAMERA, ENT_BOUNCE };
enum { CS_ALIVE = 0, CS_DEAD, CS_SPAWNING, CS_LAGGED, CS_EDITING, CS_SPECTATE };
enum { CR_DEFAULT = 0, CR_ADMIN };
enum { SM_NONE = 0, SM_DEATHCAM, SM_FOLLOW1ST, SM_FOLLOW3RD, SM_FOLLOW3RD_TRANSPARENT, SM_FLY, SM_NUM };
enum { SM_NONE = 0, SM_DEATHCAM, SM_FOLLOW1ST, SM_FOLLOW3RD, SM_FOLLOW3RD_TRANSPARENT, SM_FLY, SM_OVERVIEW, SM_NUM };
enum { FPCN_VOID = -3, FPCN_DEATHCAM = -2, FPCN_FLY = -1 };
class worldobject
+33 -1
View File
@@ -490,6 +490,27 @@ void recomputecamera()
resetcamera();
camera1->eyeheight = 1.0f;
break;
case SM_OVERVIEW:
{
// WIP, might not be released..
// FIXME : bad feeling with walls ATM because of perspective
/*camera1->yaw = 0;
camera1->pitch = -90;
camera1->o.x = mapdims[0] + mapdims[4]/2;
camera1->o.y = mapdims[1] + mapdims[5]/2;
camera1->o.z = vec(mapdims[4]/2.0f, mapdims[5]/2.0f, 0.0f).magnitude() / tan( (spectfov - 10) * RAD /2.0f);*/
// from drawminimap...
camera1->reset();
camera1->type = ENT_CAMERA;
camera1->o.x = mapdims[0] + mapdims[4]/2;
camera1->o.y = mapdims[1] + mapdims[5]/2;
camera1->o.z = mapdims[7] + 1;
camera1->pitch = -90;
camera1->yaw = 0;
disableraytable();
break;
}
case SM_FOLLOW1ST:
{
playerent *f = updatefollowplayer();
@@ -815,7 +836,17 @@ VARP(spechudgun, 0, 1, 1);
void setperspective(float fovy, float aspect, float nearplane, float farplane)
{
GLdouble ydist = nearplane * tan(fovy/2*RAD), xdist = ydist * aspect;
glFrustum(-xdist, xdist, -ydist, ydist, nearplane, farplane);
if(player1->isspectating() && player1->spectatemode == SM_OVERVIEW)
{
int gdim = max(mapdims[4], mapdims[5]);
if(!gdim) gdim = ssize/2;
int orthd = 2 + gdim/2;
glOrtho(-orthd, orthd, -orthd, orthd, 0, (mapdims[7]-mapdims[6])+2); // depth of map +2 covered
}
else
{
glFrustum(-xdist, xdist, -ydist, ydist, nearplane, farplane);
}
}
void sethudgunperspective(bool on)
@@ -975,6 +1006,7 @@ void gl_drawframe(int w, int h, float changelod, float curfps)
renderstrips();
xtraverts = 0;
startmodelbatches();
+1 -1
View File
@@ -270,7 +270,7 @@ void distlod(int &low, int &high, int angle, float widef)
void render_world(float vx, float vy, float vh, float changelod, int yaw, int pitch, float fov, float fovy, int w, int h)
{
loopi(LARGEST_FACTOR) stats[i] = 0;
min_lod = minimap ? MAX_LOD : MIN_LOD+abs(pitch)/12;
min_lod = minimap || (player1->isspectating() && player1->spectatemode == SM_OVERVIEW) ? MAX_LOD : MIN_LOD+abs(pitch)/12;
yaw = 360-yaw;
float widef = fov/75.0f;
int cdist = abs(yaw%90-45);