mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
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
This commit is contained in:
parent
5209d30f13
commit
5eae5cdc50
2 changed files with 151 additions and 150 deletions
|
@ -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);
|
||||
|
|
|
@ -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<n; i++)
|
||||
{
|
||||
ox = px[i]-ghalfx; oy = py[i]-ghoriz; oz = ghalfx;
|
||||
|
||||
//Tilt rotation (backwards)
|
||||
ox2 = ox*gctang + oy*gstang;
|
||||
oy2 = oy*gctang - ox*gstang;
|
||||
oz2 = oz;
|
||||
|
||||
//Up/down rotation (backwards)
|
||||
px[i] = ox2;
|
||||
py[i] = oy2*gchang + oz2*gshang;
|
||||
pz[i] = oz2*gchang - oy2*gshang;
|
||||
}
|
||||
|
||||
if (searchit == 2)
|
||||
{
|
||||
int32_t vx, vy, vz;
|
||||
int32_t cz, fz;
|
||||
hitdata_t hitinfo;
|
||||
vec3_t vect;
|
||||
|
||||
ox2 = searchx-ghalfx; oy2 = searchy-ghoriz; oz2 = ghalfx;
|
||||
|
||||
//Tilt rotation
|
||||
ox = ox2*gctang + oy2*gstang;
|
||||
oy = oy2*gctang - ox2*gstang;
|
||||
oz = oz2;
|
||||
|
||||
//Up/down rotation
|
||||
ox2 = oz*gchang - oy*gshang;
|
||||
oy2 = ox;
|
||||
oz2 = oy*gchang + oz*gshang;
|
||||
|
||||
//Standard Left/right rotation
|
||||
vx = (int32_t)(ox2*((float)cosglobalang) - oy2*((float)singlobalang));
|
||||
vy = (int32_t)(ox2*((float)singlobalang) + oy2*((float)cosglobalang));
|
||||
vz = (int32_t)(oz2*16384.0);
|
||||
|
||||
vect.x = globalposx;
|
||||
vect.y = globalposy;
|
||||
vect.z = globalposz;
|
||||
|
||||
hitallsprites = 1;
|
||||
hitscan((const vec3_t *)&vect,globalcursectnum, //Start position
|
||||
vx>>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.z<cz) searchstat = 1; else if (hitinfo.pos.z>fz) 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<n; i++)
|
||||
{
|
||||
ox = px[i]-ghalfx; oy = py[i]-ghoriz; oz = ghalfx;
|
||||
|
||||
//Tilt rotation (backwards)
|
||||
ox2 = ox*gctang + oy*gstang;
|
||||
oy2 = oy*gctang - ox*gstang;
|
||||
oz2 = oz;
|
||||
|
||||
//Up/down rotation (backwards)
|
||||
px[i] = ox2;
|
||||
py[i] = oy2*gchang + oz2*gshang;
|
||||
pz[i] = oz2*gchang - oy2*gshang;
|
||||
}
|
||||
|
||||
if (searchit == 2)
|
||||
{
|
||||
int32_t vx, vy, vz;
|
||||
int32_t cz, fz;
|
||||
hitdata_t hitinfo;
|
||||
vec3_t vect;
|
||||
|
||||
ox2 = searchx-ghalfx; oy2 = searchy-ghoriz; oz2 = ghalfx;
|
||||
|
||||
//Tilt rotation
|
||||
ox = ox2*gctang + oy2*gstang;
|
||||
oy = oy2*gctang - ox2*gstang;
|
||||
oz = oz2;
|
||||
|
||||
//Up/down rotation
|
||||
ox2 = oz*gchang - oy*gshang;
|
||||
oy2 = ox;
|
||||
oz2 = oy*gchang + oz*gshang;
|
||||
|
||||
//Standard Left/right rotation
|
||||
vx = (int32_t)(ox2*((float)cosglobalang) - oy2*((float)singlobalang));
|
||||
vy = (int32_t)(ox2*((float)singlobalang) + oy2*((float)cosglobalang));
|
||||
vz = (int32_t)(oz2*16384.0);
|
||||
|
||||
vect.x = globalposx;
|
||||
vect.y = globalposy;
|
||||
vect.z = globalposz;
|
||||
|
||||
hitallsprites = 1;
|
||||
hitscan((const vec3_t *)&vect,globalcursectnum, //Start position
|
||||
vx>>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.z<cz) searchstat = 1; else if (hitinfo.pos.z>fz) 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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue