From d70d8e52382dbd2df4f9c35853655564e3ff96db Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 12 Aug 2007 09:14:43 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1228 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/protos.h | 2 +- source/src/rendercubes.cpp | 41 ++++++++++++++++---------------------- source/src/rendermodel.cpp | 3 +-- source/src/texture.cpp | 7 ++----- source/src/vertmodel.h | 6 +----- source/src/worldio.cpp | 3 +-- 6 files changed, 23 insertions(+), 39 deletions(-) diff --git a/source/src/protos.h b/source/src/protos.h index b596ca2f..1e6c6746 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -80,7 +80,7 @@ extern Texture *crosshair; extern void createtexture(int tnum, int w, int h, void *pixels, int clamp, bool mipmap, GLenum format); extern Texture *textureload(const char *name, int clamp = 0); -extern int lookuptexture(int tex, int &xs, int &ys); +extern Texture *lookuptexture(int tex); extern void draw_envbox(int fogdist); extern int maxtmus; diff --git a/source/src/rendercubes.cpp b/source/src/rendercubes.cpp index e7ba725f..572c2fad 100644 --- a/source/src/rendercubes.cpp +++ b/source/src/rendercubes.cpp @@ -45,8 +45,7 @@ int renderedtexs = 0; void renderstripssky() { if(skystrips.tris.first.empty() && skystrips.tristrips.first.empty() && skystrips.quads.first.empty()) return; - int xs, ys; - glBindTexture(GL_TEXTURE_2D, lookuptexture(DEFAULT_SKY, xs, ys)); + glBindTexture(GL_TEXTURE_2D, lookuptexture(DEFAULT_SKY)->id); RENDERSTRIPS(skystrips.tris, GL_TRIANGLES); RENDERSTRIPS(skystrips.tristrips, GL_TRIANGLE_STRIP); RENDERSTRIPS(skystrips.quads, GL_QUADS); @@ -54,11 +53,10 @@ void renderstripssky() void renderstrips() { - int xs, ys; loopj(renderedtexs) { stripbatch &sb = stripbatches[j]; - glBindTexture(GL_TEXTURE_2D, lookuptexture(sb.tex, xs, ys)); + glBindTexture(GL_TEXTURE_2D, lookuptexture(sb.tex)->id); RENDERSTRIPS(sb.tris, GL_TRIANGLES); RENDERSTRIPS(sb.tristrips, GL_TRIANGLE_STRIP); RENDERSTRIPS(sb.quads, GL_QUADS); @@ -143,10 +141,9 @@ void render_flat(int wtex, int x, int y, int size, int h, sqr *l1, sqr *l2, sqr { if(showm) { l3 = l1 = &sbright; l4 = l2 = &sdark; } - int sx, sy; - lookuptexture(wtex, sx, sy); - float xf = TEXTURESCALE/sx; - float yf = TEXTURESCALE/sy; + Texture *t = lookuptexture(wtex); + float xf = TEXTURESCALE/t->xs; + float yf = TEXTURESCALE/t->ys; float xs = size*xf; float ys = size*yf; float xo = xf*x; @@ -221,10 +218,9 @@ void render_flatdelta(int wtex, int x, int y, int size, float h1, float h2, floa { if(showm) { l3 = l1 = &sbright; l4 = l2 = &sdark; } - int sx, sy; - lookuptexture(wtex, sx, sy); - float xf = TEXTURESCALE/sx; - float yf = TEXTURESCALE/sy; + Texture *t = lookuptexture(wtex); + float xf = TEXTURESCALE/t->xs; + float yf = TEXTURESCALE/t->ys; float xs = size*xf; float ys = size*yf; float xo = xf*x; @@ -276,19 +272,17 @@ void render_2tris(sqr *h, sqr *s, int x1, int y1, int x2, int y2, int x3, int y3 { stripend(); - int sx, sy; - lookuptexture(h->ftex, sx, sy); - float xf = TEXTURESCALE/sx; - float yf = TEXTURESCALE/sy; - + Texture *t = lookuptexture(h->ftex); + float xf = TEXTURESCALE/t->xs; + float yf = TEXTURESCALE/t->ys; vert(x1, y1, h->floor, l1, xf*x1, yf*y1); vert(x2, y2, h->floor, l2, xf*x2, yf*y2); vert(x3, y3, h->floor, l3, xf*x3, yf*y3); addstrip(mergestrips ? GL_TRIANGLES : GL_TRIANGLE_STRIP, h->ftex, verts.length()-3, 3); - lookuptexture(h->ctex, sx, sy); - xf = TEXTURESCALE/sx; - yf = TEXTURESCALE/sy; + t = lookuptexture(h->ctex); + xf = TEXTURESCALE/t->xs; + yf = TEXTURESCALE/t->ys; vert(x3, y3, h->ceil, l3, xf*x3, yf*y3); vert(x2, y2, h->ceil, l2, xf*x2, yf*y2); @@ -317,10 +311,9 @@ void render_square(int wtex, float floor1, float floor2, float ceil1, float ceil stripend(); if(showm) { l1 = &sbright; l2 = &sdark; } - int sx, sy; - lookuptexture(wtex, sx, sy); - float xf = TEXTURESCALE/sx; - float yf = TEXTURESCALE/sy; + Texture *t = lookuptexture(wtex); + float xf = TEXTURESCALE/t->xs; + float yf = TEXTURESCALE/t->ys; float xs = size*xf; float xo = xf*(x1==x2 ? min(y1,y2) : min(x1,x2)); diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 1c2631d4..531b2592 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -318,13 +318,12 @@ void preload_entmodels() void preload_mapmodels() { - int xs, ys; loopv(ents) { entity &e = ents[i]; if(e.type!=MAPMODEL || !mapmodels.inrange(e.attr2)) continue; if(!loadmodel(NULL, e.attr2)) continue; - if(e.attr4) lookuptexture(e.attr4, xs, ys); + if(e.attr4) lookuptexture(e.attr4); } } diff --git a/source/src/texture.cpp b/source/src/texture.cpp index 28ee9b08..e06c029f 100644 --- a/source/src/texture.cpp +++ b/source/src/texture.cpp @@ -121,7 +121,7 @@ void texture(char *aframe, char *name) COMMAND(texturereset, ARG_NONE); COMMAND(texture, ARG_2STR); -int lookuptexture(int tex, int &xs, int &ys) +Texture *lookuptexture(int tex) { Texture *t = crosshair; if(slots.inrange(tex)) @@ -135,10 +135,7 @@ int lookuptexture(int tex, int &xs, int &ys) } if(s.tex) t = s.tex; } - - xs = t->xs; - ys = t->ys; - return t->id; + return t; } Texture *sky[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; diff --git a/source/src/vertmodel.h b/source/src/vertmodel.h index 23ff664b..55545b0c 100644 --- a/source/src/vertmodel.h +++ b/source/src/vertmodel.h @@ -128,11 +128,7 @@ struct vertmodel : model if(!(as.anim&ANIM_NOSKIN)) { GLuint id = tex < 0 ? -tex : skin->id; - if(tex > 0) - { - int xs, ys; - id = lookuptexture(tex, xs, ys); - } + if(tex > 0) id = lookuptexture(tex)->id; if(id!=lasttex) { glBindTexture(GL_TEXTURE_2D, id); diff --git a/source/src/worldio.cpp b/source/src/worldio.cpp index 5fc047d9..ecfceca9 100644 --- a/source/src/worldio.cpp +++ b/source/src/worldio.cpp @@ -357,9 +357,8 @@ void load_world(char *mname) // still supports all map formats that have execfile("config/default_map_settings.cfg"); execfile(pcfname); execfile(mcfname); - int xs, ys; c2skeepalive(); - loopi(256) if(texuse[i]) lookuptexture(i, xs, ys); + loopi(256) if(texuse[i]) lookuptexture(i); c2skeepalive(); preload_mapmodels(); c2skeepalive();