| 802 | COMMAND(clearminimap, ""); |
| 803 | VARFP(minimapres, 7, 9, 10, clearminimap()); |
| 804 | void drawminimap(int w, int h) |
| 805 | { |
| 806 | if(!minimapdirty) return; |
| 807 | int size = 1<<minimapres, sizelimit = min(hwtexsize, min(w, h)); |
| 808 | while(size > sizelimit) size /= 2; |
| 809 | if(size!=minimaplastsize && minimaptex) |
| 810 | { |
| 811 | glDeleteTextures(1, &minimaptex); |
| 812 | minimaptex = 0; |
| 813 | } |
| 814 | if(!minimaptex) |
| 815 | { |
| 816 | glGenTextures(1, &minimaptex); |
| 817 | createtexture(minimaptex, size, size, NULL, 3, false, false, GL_RGB); |
| 818 | minimaplastsize = size; |
| 819 | } |
| 820 | minimap = true; |
| 821 | disableraytable(); |
| 822 | physent *oldcam = camera1; |
| 823 | physent minicam; |
| 824 | camera1 = &minicam; |
| 825 | camera1->type = ENT_CAMERA; |
| 826 | camera1->o.x = clmapdims.xm; |
| 827 | camera1->o.y = clmapdims.ym; |
| 828 | |
| 829 | float gdim = max(clmapdims.xspan, clmapdims.yspan); |
| 830 | |
| 831 | if(gdim < 1) gdim = ssize/2.0f; |
| 832 | camera1->o.z = clmapdims.maxceil + 1; |
| 833 | camera1->pitch = -90; |
| 834 | camera1->yaw = 0; |
| 835 | |
| 836 | float orthd = gdim/2.0f; |
| 837 | glViewport(0, 0, size, size); |
| 838 | |
| 839 | glClearDepth(0.0); |
| 840 | glClearColor(0, 0, 0, 0); |
| 841 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
| 842 | glMatrixMode(GL_PROJECTION); |
| 843 | glLoadIdentity(); |
| 844 | glOrtho(-orthd, orthd, -orthd, orthd, 0, (clmapdims.maxceil - clmapdims.minfloor) + 2); // depth of map +2 covered |
| 845 | glScalef(1, -1, 1); |
| 846 | glMatrixMode(GL_MODELVIEW); |
| 847 | glCullFace(GL_BACK); |
| 848 | glDisable(GL_FOG); |
| 849 | glEnable(GL_TEXTURE_2D); |
| 850 | transplayer(); |
| 851 | resetcubes(); |
| 852 | render_world(camera1->o.x, camera1->o.y, camera1->o.z, 1.0f, |
| 853 | (int)camera1->yaw, (int)camera1->pitch, 90.0f, 90.0f, size, size); |
| 854 | setupstrips(); |
| 855 | setuptmu(0, "T * P x 2"); |
| 856 | glDepthFunc(GL_ALWAYS); |
| 857 | renderstrips(); |
| 858 | glDepthFunc(GL_LESS); |
| 859 | rendermapmodels(); |
| 860 | renderzones(clmapdims.maxceil); |
| 861 | resettmu(0); |
no test coverage detected