From 5eae5cdc505d0327bfcedc8210f6739b7303b1aa Mon Sep 17 00:00:00 2001 From: plagman Date: Sun, 17 May 2009 16:12:53 +0000 Subject: [PATCH] Moves editorselect and clearmapdata to non-external function categories, makes them static and prototypes them in the header. git-svn-id: https://svn.eduke32.com/eduke32@1387 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/polymer.h | 2 + polymer/eduke32/build/src/polymer.c | 299 ++++++++++++------------ 2 files changed, 151 insertions(+), 150 deletions(-) diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index 49c6b53ee..7ee2a8f2f 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -284,6 +284,8 @@ static void polymer_displayrooms(int16_t sectnum); static void polymer_drawplane(_prplane* plane); static inline void polymer_inb4mirror(GLfloat* buffer, GLfloat* plane); static void polymer_animatesprites(void); +static void polymer_clearmapdata(void); +static void polymer_editorselect(void); // SECTORS static int32_t polymer_initsector(int16_t sectnum); static int32_t polymer_updatesector(int16_t sectnum); diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index 1e1df0e73..e0274fafb 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -664,54 +664,6 @@ void polymer_glinit(void) bglCullFace(GL_BACK); } -void polymer_clearmapdata(void) -{ - int32_t i; - - i = 0; - while (i < MAXSECTORS) - { - if (prsectors[i]) - { - if (prsectors[i]->verts) Bfree(prsectors[i]->verts); - if (prsectors[i]->floor.buffer) Bfree(prsectors[i]->floor.buffer); - if (prsectors[i]->ceil.buffer) Bfree(prsectors[i]->ceil.buffer); - if (prsectors[i]->floor.indices) Bfree(prsectors[i]->floor.indices); - if (prsectors[i]->ceil.indices) Bfree(prsectors[i]->ceil.indices); - if (prsectors[i]->ceil.vbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.vbo); - if (prsectors[i]->ceil.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.ivbo); - if (prsectors[i]->floor.vbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.vbo); - if (prsectors[i]->floor.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.ivbo); - - Bfree(prsectors[i]); - prsectors[i] = NULL; - } - - i++; - } - - i = 0; - while (i < MAXWALLS) - { - if (prwalls[i]) - { - if (prwalls[i]->bigportal) Bfree(prwalls[i]->bigportal); - if (prwalls[i]->mask.buffer) Bfree(prwalls[i]->mask.buffer); - if (prwalls[i]->cap) Bfree(prwalls[i]->cap); - if (prwalls[i]->wall.buffer) Bfree(prwalls[i]->wall.buffer); - if (prwalls[i]->wall.vbo) bglDeleteBuffersARB(1, &prwalls[i]->wall.vbo); - if (prwalls[i]->over.vbo) bglDeleteBuffersARB(1, &prwalls[i]->over.vbo); - if (prwalls[i]->mask.vbo) bglDeleteBuffersARB(1, &prwalls[i]->mask.vbo); - if (prwalls[i]->stuffvbo) bglDeleteBuffersARB(1, &prwalls[i]->stuffvbo); - - Bfree(prwalls[i]); - prwalls[i] = NULL; - } - - i++; - } -} - void polymer_loadboard(void) { int32_t i; @@ -739,108 +691,6 @@ void polymer_loadboard(void) if (pr_verbosity >= 1) OSD_Printf("PR : Board loaded.\n"); } -void polymer_editorselect(void) -{ - - int32_t i, n; - double ox, oy, oz, ox2, oy2, oz2, px[6], py[6], pz[6]; - - //Polymost supports true look up/down :) Here, we convert horizon to angle. - //gchang&gshang are cos&sin of this angle (respectively) - ghalfx = (double)halfxdimen; grhalfxdown10 = 1.0/(((double)ghalfx)*1024); - ghoriz = (double)globalhoriz; - - gvisibility = ((float)globalvisibility)*FOGSCALE; - - ghoriz = (double)(ydimen>>1); - - //global cos/sin tilt angle - gctang = cos(gtang); - gstang = sin(gtang); - if (fabs(gstang) < .001) //This hack avoids nasty precision bugs in domost() - { gstang = 0; if (gctang > 0) gctang = 1.0; else gctang = -1.0; } - - //Generate viewport trapezoid (for handling screen up/down) - px[0] = px[3] = 0-1; px[1] = px[2] = windowx2+1-windowx1+2; - py[0] = py[1] = 0-1; py[2] = py[3] = windowy2+1-windowy1+2; n = 4; - for (i=0; i>12,vy>>12,vz>>8,&hitinfo,0xffff0030); - getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); - hitallsprites = 0; - - searchsector = hitinfo.hitsect; - if (hitinfo.pos.zfz) searchstat = 2; else if (hitinfo.hitwall >= 0) - { - searchwall = hitinfo.hitwall; searchstat = 0; - if (wall[hitinfo.hitwall].nextwall >= 0) - { - int32_t cz, fz; - getzsofslope(wall[hitinfo.hitwall].nextsector,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); - if (hitinfo.pos.z > fz) - { - if (wall[hitinfo.hitwall].cstat&2) //'2' bottoms of walls - searchwall = wall[hitinfo.hitwall].nextwall; - } - else if ((hitinfo.pos.z > cz) && (wall[hitinfo.hitwall].cstat&(16+32))) //masking or 1-way - searchstat = 4; - } - } - else if (hitinfo.hitsprite >= 0) { searchwall = hitinfo.hitsprite; searchstat = 3; } - else - { - int32_t cz, fz; - getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); - if ((hitinfo.pos.z<<1) < cz+fz) searchstat = 1; else searchstat = 2; - //if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/ - } - searchit = 0; - } -} - void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum) { int16_t cursectnum; @@ -1713,6 +1563,155 @@ static void polymer_animatesprites(void) asi.animatesprites(globalposx, globalposy, viewangle, asi.smoothratio); } +static void polymer_clearmapdata(void) +{ + int32_t i; + + i = 0; + while (i < MAXSECTORS) + { + if (prsectors[i]) + { + if (prsectors[i]->verts) Bfree(prsectors[i]->verts); + if (prsectors[i]->floor.buffer) Bfree(prsectors[i]->floor.buffer); + if (prsectors[i]->ceil.buffer) Bfree(prsectors[i]->ceil.buffer); + if (prsectors[i]->floor.indices) Bfree(prsectors[i]->floor.indices); + if (prsectors[i]->ceil.indices) Bfree(prsectors[i]->ceil.indices); + if (prsectors[i]->ceil.vbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.vbo); + if (prsectors[i]->ceil.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->ceil.ivbo); + if (prsectors[i]->floor.vbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.vbo); + if (prsectors[i]->floor.ivbo) bglDeleteBuffersARB(1, &prsectors[i]->floor.ivbo); + + Bfree(prsectors[i]); + prsectors[i] = NULL; + } + + i++; + } + + i = 0; + while (i < MAXWALLS) + { + if (prwalls[i]) + { + if (prwalls[i]->bigportal) Bfree(prwalls[i]->bigportal); + if (prwalls[i]->mask.buffer) Bfree(prwalls[i]->mask.buffer); + if (prwalls[i]->cap) Bfree(prwalls[i]->cap); + if (prwalls[i]->wall.buffer) Bfree(prwalls[i]->wall.buffer); + if (prwalls[i]->wall.vbo) bglDeleteBuffersARB(1, &prwalls[i]->wall.vbo); + if (prwalls[i]->over.vbo) bglDeleteBuffersARB(1, &prwalls[i]->over.vbo); + if (prwalls[i]->mask.vbo) bglDeleteBuffersARB(1, &prwalls[i]->mask.vbo); + if (prwalls[i]->stuffvbo) bglDeleteBuffersARB(1, &prwalls[i]->stuffvbo); + + Bfree(prwalls[i]); + prwalls[i] = NULL; + } + + i++; + } +} + +static void polymer_editorselect(void) +{ + int32_t i, n; + double ox, oy, oz, ox2, oy2, oz2, px[6], py[6], pz[6]; + + //Polymost supports true look up/down :) Here, we convert horizon to angle. + //gchang&gshang are cos&sin of this angle (respectively) + ghalfx = (double)halfxdimen; grhalfxdown10 = 1.0/(((double)ghalfx)*1024); + ghoriz = (double)globalhoriz; + + gvisibility = ((float)globalvisibility)*FOGSCALE; + + ghoriz = (double)(ydimen>>1); + + //global cos/sin tilt angle + gctang = cos(gtang); + gstang = sin(gtang); + if (fabs(gstang) < .001) //This hack avoids nasty precision bugs in domost() + { gstang = 0; if (gctang > 0) gctang = 1.0; else gctang = -1.0; } + + //Generate viewport trapezoid (for handling screen up/down) + px[0] = px[3] = 0-1; px[1] = px[2] = windowx2+1-windowx1+2; + py[0] = py[1] = 0-1; py[2] = py[3] = windowy2+1-windowy1+2; n = 4; + for (i=0; i>12,vy>>12,vz>>8,&hitinfo,0xffff0030); + getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); + hitallsprites = 0; + + searchsector = hitinfo.hitsect; + if (hitinfo.pos.zfz) searchstat = 2; else if (hitinfo.hitwall >= 0) + { + searchwall = hitinfo.hitwall; searchstat = 0; + if (wall[hitinfo.hitwall].nextwall >= 0) + { + int32_t cz, fz; + getzsofslope(wall[hitinfo.hitwall].nextsector,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); + if (hitinfo.pos.z > fz) + { + if (wall[hitinfo.hitwall].cstat&2) //'2' bottoms of walls + searchwall = wall[hitinfo.hitwall].nextwall; + } + else if ((hitinfo.pos.z > cz) && (wall[hitinfo.hitwall].cstat&(16+32))) //masking or 1-way + searchstat = 4; + } + } + else if (hitinfo.hitsprite >= 0) { searchwall = hitinfo.hitsprite; searchstat = 3; } + else + { + int32_t cz, fz; + getzsofslope(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,&cz,&fz); + if ((hitinfo.pos.z<<1) < cz+fz) searchstat = 1; else searchstat = 2; + //if (vz < 0) searchstat = 1; else searchstat = 2; //Won't work for slopes :/ + } + searchit = 0; + } +} + // SECTORS static int32_t polymer_initsector(int16_t sectnum) {