minimap
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@880 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+5
-1
@@ -57,7 +57,11 @@ void screenshot(char *imagepath)
|
||||
memcpy(dest, (char *)image->pixels+image->pitch*(scr_h-1-idx), 3*scr_w);
|
||||
endianswap(dest, 3, scr_w);
|
||||
}
|
||||
if(!imagepath) s_sprintf(imagepath)("screenshots/screenshot_%d.bmp", lastmillis);
|
||||
if(!imagepath)
|
||||
{
|
||||
imagepath = new string;
|
||||
s_sprintf(imagepath)("screenshots/screenshot_%d.bmp", lastmillis);
|
||||
}
|
||||
SDL_SaveBMP(temp, path(imagepath));
|
||||
SDL_FreeSurface(temp);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ extern void mipstats(int a, int b, int c);
|
||||
extern void addstrip(int type, int tex, int start, int n);
|
||||
extern int lookuptexture(int tex, int &xs, int &ys);
|
||||
extern char *hudgunnames[];
|
||||
extern void createminimap(char *map);
|
||||
|
||||
// rendercubes
|
||||
extern void resetcubes();
|
||||
|
||||
@@ -341,14 +341,15 @@ void drawradarent(float x, float y, float yaw, int col, int row, float iconsize,
|
||||
void drawradar(const vec ¢er, int radarres, int w, int h, bool fullscreen)
|
||||
{
|
||||
static Texture *radar = NULL;
|
||||
static char *map = NULL;
|
||||
|
||||
static string map;
|
||||
char *curmap = getclientmap();
|
||||
|
||||
if(!map || strcmp(map, curmap)) // update once on map load
|
||||
if(strcmp(map, curmap)) // update once on map load
|
||||
{
|
||||
map = curmap;
|
||||
s_sprintfd(texpath)("packages/%s.jpg", map);
|
||||
s_strcpy(map, curmap);
|
||||
s_sprintfd(texpath)("packages/%s.bmp", map); // fixme: image format
|
||||
FILE *f = fopen(texpath, "r"); // check for existence first to avoid tex load error
|
||||
if(!f) createminimap(texpath); // create if not available
|
||||
radar = textureload(texpath);
|
||||
}
|
||||
|
||||
|
||||
@@ -441,3 +441,65 @@ void gl_drawframe(int w, int h, float changelod, float curfps)
|
||||
glEnable(GL_CULL_FACE);
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
|
||||
void createminimap(char *map)
|
||||
{
|
||||
if(!map) return;
|
||||
|
||||
extern void toggleocull();
|
||||
extern void screenshot(char *imagepath);
|
||||
extern int scr_w, scr_h;
|
||||
|
||||
int changelod = 100, curfps = 100;
|
||||
|
||||
toggleocull();
|
||||
|
||||
camera1 = new physent();
|
||||
camera1->o.x = camera1->o.y = ssize/2;
|
||||
camera1->o.z = ssize/3;
|
||||
camera1->pitch = -90;
|
||||
camera1->yaw = 0;
|
||||
|
||||
glClearColor(0, 0, 0, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-ssize/2, ssize/2, -ssize/2, ssize/2, -1, ssize);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
resetcubes();
|
||||
|
||||
render_world(camera1->o.x, camera1->o.y, camera1->o.z, changelod,
|
||||
(int)camera1->yaw, (int)camera1->pitch, (float)fov, scr_w, scr_h);
|
||||
finishstrips();
|
||||
|
||||
setupworld();
|
||||
|
||||
renderstripssky();
|
||||
|
||||
glLoadIdentity();
|
||||
glRotatef(camera1->pitch, -1, 0, 0);
|
||||
glRotatef(camera1->yaw, 0, 1, 0);
|
||||
glRotatef(90, 1, 0, 0);
|
||||
glColor3f(1, 1, 1);
|
||||
glDisable(GL_FOG);
|
||||
glDepthFunc(GL_GREATER);
|
||||
draw_envbox(fog*4/3);
|
||||
glDepthFunc(GL_LESS);
|
||||
glEnable(GL_FOG);
|
||||
|
||||
transplayer();
|
||||
overbright(2);
|
||||
renderstrips();
|
||||
renderentities();
|
||||
|
||||
delete camera1;
|
||||
toggleocull();
|
||||
|
||||
screenshot(map);
|
||||
}
|
||||
|
||||
COMMAND(createminimap, ARG_NONE);
|
||||
@@ -183,5 +183,4 @@ void preload_mapmodels()
|
||||
if(!loadmodel(NULL, e.attr2)) continue;
|
||||
if(e.attr4) lookuptexture(e.attr4, xs, ys);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user