mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
fix building with MSVC after Helixhorned's commit
fix FastLZ mipmap corruption issue fix Polymer MSVC warnings rewrote qsprintf to take up to 32 parameters, either quotes or gamevars added qstrncat to concatenate n characters of one quote to another exposed internal sectorofwall() function to CON changed CON parser to count ( ) ; and , as whitespace so people can make their code more readable added ACTIVATOR and ACTIVATORLOCKED support to SE49 and SE50 added SPRITE_USEACTIVATOR flag to allow actor execution based on whether a sector is "locked" or not rearranged a few structures for faster array lookups fixed EVENT_HOLSTER git-svn-id: https://svn.eduke32.com/eduke32@1457 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a3c0bee4a3
commit
1538f39289
29 changed files with 990 additions and 890 deletions
|
@ -351,7 +351,7 @@ static inline void dtol(double d, int32_t *a)
|
|||
#endif
|
||||
|
||||
|
||||
#define BMAX_PATH 260
|
||||
#define BMAX_PATH 256
|
||||
|
||||
|
||||
struct Bdirent {
|
||||
|
|
|
@ -80,9 +80,11 @@ ACQUIRE_LOCK, RELEASE_LOCK, TRY_LOCK, IS_LOCKED and NULL_LOCK_INITIALIZER.
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifndef UNREFERENCED_PARAMETER
|
||||
#define UNREFERENCED_PARAMETER(x) x=x
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NO_MALLINFO
|
||||
#define NO_MALLINFO 0
|
||||
|
|
|
@ -163,6 +163,7 @@ typedef struct s_prplanelist {
|
|||
struct s_prplanelist* n;
|
||||
} _prplanelist;
|
||||
|
||||
#pragma pack(push,1)
|
||||
typedef struct s_prlight {
|
||||
int32_t x, y, z, horiz, range;
|
||||
int16_t angle, faderadius, radius, sector;
|
||||
|
@ -189,6 +190,7 @@ extern int32_t lightcount;
|
|||
|
||||
extern _prlight gamelights[PR_MAXLIGHTS];
|
||||
extern int32_t gamelightcount;
|
||||
#pragma pack(pop)
|
||||
|
||||
// RENDER TARGETS
|
||||
typedef struct s_prrt {
|
||||
|
|
|
@ -380,7 +380,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
}
|
||||
if (!boardfilename[0])
|
||||
{
|
||||
Bstrncpy(boardfilename, argv[i], BMAX_PATH-4-1);
|
||||
Bstrncpy(boardfilename, argv[i], BMAX_PATH);
|
||||
boardfilename[i-BMAX_PATH] = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
static intptr_t kzipopen(char *filnam)
|
||||
{
|
||||
uint32_t i;
|
||||
char newst[BMAX_PATH+4];
|
||||
char newst[BMAX_PATH];
|
||||
|
||||
newst[0] = '|';
|
||||
for (i=0; filnam[i] && (i < sizeof(newst)-2); i++) newst[i+1] = filnam[i];
|
||||
|
|
|
@ -7419,8 +7419,9 @@ int32_t loadmaphack(char *filename)
|
|||
case T_LIGHT: // light sector x y z range r g b radius faderadius angle horiz minshade maxshade priority tilenum
|
||||
{
|
||||
int32_t value;
|
||||
#pragma pack(push,1)
|
||||
_prlight light;
|
||||
|
||||
#pragma pack(pop)
|
||||
scriptfile_getnumber(script, &value);
|
||||
light.sector = value;
|
||||
scriptfile_getnumber(script, &value);
|
||||
|
|
|
@ -653,7 +653,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
{
|
||||
int32_t i,j, bpl, xsiz=0, ysiz=0, osizx, osizy, texfmt = GL_RGBA, intexfmt = GL_RGBA;
|
||||
intptr_t fptr=0;
|
||||
char *skinfile, hasalpha, fn[BMAX_PATH+65];
|
||||
char *skinfile, hasalpha, fn[BMAX_PATH];
|
||||
GLuint *texidx = NULL;
|
||||
mdskinmap_t *sk, *skzero = NULL;
|
||||
int32_t doalloc = 1, filh;
|
||||
|
@ -672,7 +672,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
{
|
||||
skinfile = sk->fn;
|
||||
texidx = &sk->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)];
|
||||
strcpy(fn,skinfile);
|
||||
strncpy(fn,skinfile,BMAX_PATH);
|
||||
//OSD_Printf("Using exact match skin (pal=%d,skinnum=%d,surfnum=%d) %s\n",pal,number,surf,skinfile);
|
||||
break;
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
{
|
||||
skinfile = skzero->fn;
|
||||
texidx = &skzero->texid[(globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)];
|
||||
strcpy(fn,skinfile);
|
||||
strncpy(fn,skinfile,BMAX_PATH);
|
||||
//OSD_Printf("Using def skin 0,0 as fallback, pal=%d\n", pal);
|
||||
}
|
||||
else
|
||||
|
@ -700,7 +700,9 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
if ((unsigned)number >= (unsigned)m->numskins) number = 0;
|
||||
skinfile = m->skinfn + number*64;
|
||||
texidx = &m->texid[ number * (HICEFFECTMASK+1) + (globalnoeffect)?0:(hictinting[pal].f&HICEFFECTMASK)];
|
||||
strcpy(fn,m->basepath); strcat(fn,skinfile);
|
||||
strncpy(fn,m->basepath,BMAX_PATH);
|
||||
if ((Bstrlen(fn) + Bstrlen(skinfile)) < BMAX_PATH)
|
||||
strcat(fn,skinfile);
|
||||
//OSD_Printf("Using MD2/MD3 skin (%d) %s, pal=%d\n",number,skinfile,pal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#define POLYMER_C
|
||||
#include "polymer.h"
|
||||
#include "engine_priv.h"
|
||||
#include <float.h>
|
||||
|
||||
// CVARS
|
||||
int32_t pr_lighting = 1;
|
||||
|
@ -134,12 +135,14 @@ GLuint skyboxdatavbo;
|
|||
GLfloat artskydata[16];
|
||||
|
||||
// LIGHTS
|
||||
#pragma pack(push,1)
|
||||
_prlight prlights[PR_MAXLIGHTS];
|
||||
int32_t lightcount;
|
||||
int32_t curlight;
|
||||
|
||||
_prlight gamelights[PR_MAXLIGHTS];
|
||||
int32_t gamelightcount;
|
||||
#pragma pack(pop)
|
||||
|
||||
static GLfloat shadowBias[] =
|
||||
{
|
||||
|
@ -728,11 +731,11 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
|||
horizang = (float)(-getangle(128, dahoriz-100)) / (2048.0f / 360.0f);
|
||||
tiltang = (gtang * 90.0f);
|
||||
|
||||
if (searchit == 2) polymer_editorselect();
|
||||
// if (searchit == 2) polymer_editorselect();
|
||||
|
||||
pos[0] = daposy;
|
||||
pos[0] = (float)daposy;
|
||||
pos[1] = -(float)(daposz) / 16.0f;
|
||||
pos[2] = -daposx;
|
||||
pos[2] = -(float)daposx;
|
||||
|
||||
polymer_updatelights();
|
||||
|
||||
|
@ -758,7 +761,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
|||
// the angle factor is computed from eyeballed values
|
||||
// need to recompute it if we ever change the max horiz amplitude
|
||||
if (!pth || !(pth->flags & 4))
|
||||
skyhoriz /= 4.3027;
|
||||
skyhoriz /= 4.3027f;
|
||||
|
||||
bglMatrixMode(GL_MODELVIEW);
|
||||
bglLoadIdentity();
|
||||
|
@ -840,10 +843,10 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
|||
|
||||
curmodelviewmatrix = rootmodelviewmatrix;
|
||||
|
||||
#ifdef M32_ALTAIMING
|
||||
// #ifdef M32_ALTAIMING
|
||||
// only showcase for now...
|
||||
polymer_alt_editorselect();
|
||||
#endif
|
||||
if (searchit == 2) polymer_alt_editorselect();
|
||||
// #endif
|
||||
|
||||
// build globals used by rotatesprite
|
||||
viewangle = daang;
|
||||
|
@ -981,23 +984,23 @@ void polymer_drawsprite(int32_t snum)
|
|||
ysize = h_ysize[curpicnum];
|
||||
}
|
||||
|
||||
xsize *= xratio;
|
||||
ysize *= yratio;
|
||||
xsize = (int32_t)(xsize * xratio);
|
||||
ysize = (int32_t)(ysize * yratio);
|
||||
|
||||
tilexoff = (int32_t)tspr->xoffset;
|
||||
tileyoff = (int32_t)tspr->yoffset;
|
||||
tilexoff += (int8_t)((usehightile&&h_xsize[curpicnum])?(h_xoffs[curpicnum]):((picanm[curpicnum]>>8)&255));
|
||||
tileyoff += (int8_t)((usehightile&&h_xsize[curpicnum])?(h_yoffs[curpicnum]):((picanm[curpicnum]>>16)&255));
|
||||
|
||||
xoff = tilexoff * xratio;
|
||||
yoff = tileyoff * yratio;
|
||||
xoff = (int32_t)(tilexoff * xratio);
|
||||
yoff = (int32_t)(tileyoff * yratio);
|
||||
|
||||
if ((tspr->cstat & 128) && (((tspr->cstat>>4) & 3) != 2))
|
||||
yoff -= ysize / 2;
|
||||
|
||||
spos[0] = tspr->y;
|
||||
spos[0] = (float)tspr->y;
|
||||
spos[1] = -(float)(tspr->z) / 16.0f;
|
||||
spos[2] = -tspr->x;
|
||||
spos[2] = -(float)tspr->x;
|
||||
|
||||
bglMatrixMode(GL_MODELVIEW);
|
||||
bglPushMatrix();
|
||||
|
@ -1137,7 +1140,7 @@ void polymer_setanimatesprites(animatespritesptr animatesprites,
|
|||
|
||||
int16_t polymer_addlight(_prlight* light)
|
||||
{
|
||||
int16_t lighti;
|
||||
int32_t lighti;
|
||||
|
||||
if (lightcount >= PR_MAXLIGHTS || light->priority > pr_maxlightpriority || !pr_lighting)
|
||||
return (-1);
|
||||
|
@ -1335,9 +1338,9 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
|||
float pos[3], sqdist;
|
||||
int32_t oldoverridematerial;
|
||||
|
||||
pos[0] = globalposy;
|
||||
pos[0] = (float)globalposy;
|
||||
pos[1] = -(float)(globalposz) / 16.0f;
|
||||
pos[2] = -globalposx;
|
||||
pos[2] = -(float)globalposx;
|
||||
|
||||
sqdist = prwalls[sec->wallptr + i]->mask.plane[0] * pos[0] +
|
||||
prwalls[sec->wallptr + i]->mask.plane[1] * pos[1] +
|
||||
|
@ -1487,9 +1490,9 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
|||
mirrorlist[i].plane->plane[1] * mirrorlist[i].plane->plane[1] +
|
||||
mirrorlist[i].plane->plane[2] * mirrorlist[i].plane->plane[2]);
|
||||
|
||||
px = -coeff*mirrorlist[i].plane->plane[0]*2 + px;
|
||||
py = -coeff*mirrorlist[i].plane->plane[1]*2 + py;
|
||||
pz = -coeff*mirrorlist[i].plane->plane[2]*2 + pz;
|
||||
px = (int32_t)(-coeff*mirrorlist[i].plane->plane[0]*2 + px);
|
||||
py = (int32_t)(-coeff*mirrorlist[i].plane->plane[1]*2 + py);
|
||||
pz = (int32_t)(-coeff*mirrorlist[i].plane->plane[2]*2 + pz);
|
||||
|
||||
// map back from polymer to build
|
||||
globalposx = -pz;
|
||||
|
@ -1899,17 +1902,9 @@ void polymer_alt_editorselect(void)
|
|||
GLdouble proj[16];
|
||||
GLint view[4];
|
||||
|
||||
bglGetDoublev(GL_MODELVIEW_MATRIX, model);
|
||||
bglGetDoublev(GL_PROJECTION_MATRIX, proj);
|
||||
bglGetIntegerv(GL_VIEWPORT, view);
|
||||
|
||||
GLdouble x,y,z, viewx,viewy,viewz;
|
||||
GLfloat dadepth;
|
||||
|
||||
bglReadPixels(searchx, ydimen-searchy, 1,1, GL_DEPTH_COMPONENT, GL_FLOAT, &dadepth);
|
||||
bgluUnProject(searchx, ydimen-searchy, dadepth, model, proj, view, &x, &y, &z);
|
||||
bgluUnProject(searchx, ydimen-searchy, 0.0, model, proj, view, &viewx, &viewy, &viewz);
|
||||
|
||||
int8_t bestwhat = -1;
|
||||
int16_t bestsec = -1;
|
||||
int16_t bestwall = -1;
|
||||
|
@ -1924,6 +1919,14 @@ void polymer_alt_editorselect(void)
|
|||
qvertcount=0;
|
||||
#endif
|
||||
|
||||
bglGetDoublev(GL_MODELVIEW_MATRIX, model);
|
||||
bglGetDoublev(GL_PROJECTION_MATRIX, proj);
|
||||
bglGetIntegerv(GL_VIEWPORT, view);
|
||||
|
||||
bglReadPixels(searchx, ydimen-searchy, 1,1, GL_DEPTH_COMPONENT, GL_FLOAT, &dadepth);
|
||||
bgluUnProject(searchx, ydimen-searchy, dadepth, model, proj, view, &x, &y, &z);
|
||||
bgluUnProject(searchx, ydimen-searchy, 0.0, model, proj, view, &viewx, &viewy, &viewz);
|
||||
|
||||
for (i=0; i<numwalls; i++)
|
||||
{
|
||||
_prwall *w = prwalls[i];
|
||||
|
@ -1932,102 +1935,110 @@ void polymer_alt_editorselect(void)
|
|||
if (!w->flags.uptodate)
|
||||
continue;
|
||||
|
||||
_prplane *wp = &w->wall;
|
||||
int8_t what;
|
||||
|
||||
GLfloat *pl = wp->plane;
|
||||
GLdouble a=pl[0], b=pl[1], c=pl[2], d=pl[3];
|
||||
GLdouble nnormsq, nnorm, dist;
|
||||
|
||||
nnormsq = a*a + b*b + c*c;
|
||||
nnorm = sqrt(nnormsq);
|
||||
GLfloat npl[3] = {a/nnorm, b/nnorm, c/nnorm};
|
||||
GLfloat scrv[3] = {x-viewx, y-viewy, z-viewz};
|
||||
if (-dot3f(scrv,pl)<0)
|
||||
continue;
|
||||
|
||||
GLfloat coeff = -d/nnormsq;
|
||||
GLfloat pointonplane[3] = {coeff*a, coeff*b, coeff*c};
|
||||
GLfloat vec[3] = {x-pointonplane[0], y-pointonplane[1], z-pointonplane[2]};
|
||||
dist = fabs((a*vec[0] + b*vec[1] + c*vec[2])/nnorm);
|
||||
if (dist > bestdist)
|
||||
continue;
|
||||
|
||||
_prplane *pp;
|
||||
// TODO: the parallax cases...
|
||||
for (what=0; what < (wal->nextsector>=0?2:1); what++)
|
||||
{
|
||||
pp=wp;
|
||||
if (what==0)
|
||||
{
|
||||
if (wal->nextsector>=0 && !(w->underover&1))
|
||||
continue;
|
||||
}
|
||||
else if (what==1)
|
||||
{
|
||||
if (!(w->underover&2))
|
||||
continue;
|
||||
pp=&w->over;
|
||||
}
|
||||
/*
|
||||
else if (what==2)
|
||||
{
|
||||
if (!(wal->cstat&16) && !(wal->cstat&32))
|
||||
continue;
|
||||
pp=&w->mask;
|
||||
}
|
||||
*/
|
||||
GLfloat v1[3], v2[3], v3[3], v4[3], v12[3], v34[3], v1p_r[3], v3p_r[3];
|
||||
GLfloat v23[3], v41[3], v2p_r[3], v4p_r[3];
|
||||
GLfloat tp[3]={x,y,z};
|
||||
Bmemcpy(v1, &pp->buffer[0], 3*sizeof(GLfloat));
|
||||
Bmemcpy(v2, &pp->buffer[5], 3*sizeof(GLfloat));
|
||||
Bmemcpy(v3, &pp->buffer[10], 3*sizeof(GLfloat));
|
||||
Bmemcpy(v4, &pp->buffer[15], 3*sizeof(GLfloat));
|
||||
relvec3f(v1,v2, v12);
|
||||
relvec3f(v3,v4, v34);
|
||||
relvec3f(v1,tp, v1p_r);
|
||||
relvec3f(v3,tp, v3p_r);
|
||||
cross3f(npl,v1p_r, v1p_r);
|
||||
cross3f(npl,v3p_r, v3p_r);
|
||||
_prplane *wp = &w->wall;
|
||||
int8_t what;
|
||||
|
||||
relvec3f(v2,v3, v23);
|
||||
relvec3f(v4,v1, v41);
|
||||
GLfloat *pl = wp->plane;
|
||||
GLdouble a=pl[0], b=pl[1], c=pl[2], d=pl[3];
|
||||
GLdouble nnormsq = a*a + b*b + c*c;
|
||||
GLdouble nnorm = sqrt(nnormsq);
|
||||
GLdouble dist;
|
||||
|
||||
relvec3f(v2,tp, v2p_r);
|
||||
relvec3f(v4,tp, v4p_r);
|
||||
cross3f(npl,v2p_r, v2p_r);
|
||||
cross3f(npl,v4p_r, v4p_r);
|
||||
GLfloat npl[3] = {a/nnorm, b/nnorm, c/nnorm};
|
||||
GLfloat scrv[3] = {x-viewx, y-viewy, z-viewz};
|
||||
|
||||
if (-dot3f(scrv,pl)<0)
|
||||
continue;
|
||||
|
||||
if (dot3f(v12,v12)>0.25 && dot3f(v34,v34)>0.25
|
||||
&& (v23[1]<0 || dot3f(v23,v23)<=0.25 || dot3f(v23,v2p_r) < 0)
|
||||
&& (dot3f(v41,v41)<=0.25 || dot3f(v41,v4p_r) < 0)
|
||||
&& dot3f(v12,v1p_r) < 0 && dot3f(v34,v3p_r) < 0)
|
||||
{
|
||||
bestwhat = (what==2)?4:0;
|
||||
bestwall = i;
|
||||
bestdist = dist;
|
||||
bestsec = sectorofwall(i);
|
||||
GLfloat coeff = -d/nnormsq;
|
||||
GLfloat pointonplane[3] = {coeff*a, coeff*b, coeff*c};
|
||||
GLfloat vec[3] = {x-pointonplane[0], y-pointonplane[1], z-pointonplane[2]};
|
||||
_prplane *pp;
|
||||
|
||||
dist = fabs((a*vec[0] + b*vec[1] + c*vec[2])/nnorm);
|
||||
|
||||
if (dist > bestdist)
|
||||
continue;
|
||||
|
||||
// TODO: the parallax cases...
|
||||
for (what=0; what < (wal->nextsector>=0?2:1); what++)
|
||||
{
|
||||
GLfloat v1[3], v2[3], v3[3], v4[3], v12[3], v34[3], v1p_r[3], v3p_r[3];
|
||||
GLfloat v23[3], v41[3], v2p_r[3], v4p_r[3];
|
||||
GLfloat tp[3]={x,y,z};
|
||||
|
||||
pp=wp;
|
||||
if (what==0)
|
||||
{
|
||||
if (wal->nextsector>=0 && !(w->underover&1))
|
||||
continue;
|
||||
}
|
||||
else if (what==1)
|
||||
{
|
||||
if (!(w->underover&2))
|
||||
continue;
|
||||
pp=&w->over;
|
||||
}
|
||||
/*
|
||||
else if (what==2)
|
||||
{
|
||||
if (!(wal->cstat&16) && !(wal->cstat&32))
|
||||
continue;
|
||||
pp=&w->mask;
|
||||
}
|
||||
*/
|
||||
Bmemcpy(v1, &pp->buffer[0], 3*sizeof(GLfloat));
|
||||
Bmemcpy(v2, &pp->buffer[5], 3*sizeof(GLfloat));
|
||||
Bmemcpy(v3, &pp->buffer[10], 3*sizeof(GLfloat));
|
||||
Bmemcpy(v4, &pp->buffer[15], 3*sizeof(GLfloat));
|
||||
relvec3f(v1,v2, v12);
|
||||
relvec3f(v3,v4, v34);
|
||||
relvec3f(v1,tp, v1p_r);
|
||||
relvec3f(v3,tp, v3p_r);
|
||||
cross3f(npl,v1p_r, v1p_r);
|
||||
cross3f(npl,v3p_r, v3p_r);
|
||||
|
||||
relvec3f(v2,v3, v23);
|
||||
relvec3f(v4,v1, v41);
|
||||
|
||||
relvec3f(v2,tp, v2p_r);
|
||||
relvec3f(v4,tp, v4p_r);
|
||||
cross3f(npl,v2p_r, v2p_r);
|
||||
cross3f(npl,v4p_r, v4p_r);
|
||||
|
||||
if (dot3f(v12,v12)>0.25 && dot3f(v34,v34)>0.25
|
||||
&& (v23[1]<0 || dot3f(v23,v23)<=0.25 || dot3f(v23,v2p_r) < 0)
|
||||
&& (dot3f(v41,v41)<=0.25 || dot3f(v41,v4p_r) < 0)
|
||||
&& dot3f(v12,v1p_r) < 0 && dot3f(v34,v3p_r) < 0)
|
||||
{
|
||||
bestwhat = (what==2)?4:0;
|
||||
bestwall = i;
|
||||
bestdist = dist;
|
||||
bestsec = sectorofwall(i);
|
||||
#ifdef M32_SHOWDEBUG
|
||||
if (m32_numdebuglines<64)
|
||||
{
|
||||
Bsprintf(m32_debugstr[m32_numdebuglines++], "what=wall %d, dist=%.02f, sec=%d",
|
||||
bestwall, bestdist, bestsec);
|
||||
}
|
||||
if (qvertcount<QNUM-3)
|
||||
{
|
||||
Bmemcpy(&qcolors[3*qvertcount],col1,sizeof(col1));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v1, 3*sizeof(GLfloat));
|
||||
Bmemcpy(&qcolors[3*qvertcount],col2,sizeof(col2));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v2, 3*sizeof(GLfloat));
|
||||
Bmemcpy(&qcolors[3*qvertcount],col3,sizeof(col3));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v3, 3*sizeof(GLfloat));
|
||||
Bmemcpy(&qcolors[3*qvertcount],col4,sizeof(col4));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v4, 3*sizeof(GLfloat));
|
||||
if (m32_numdebuglines<64)
|
||||
{
|
||||
Bsprintf(m32_debugstr[m32_numdebuglines++], "what=wall %d, dist=%.02f, sec=%d",
|
||||
bestwall, bestdist, bestsec);
|
||||
}
|
||||
if (qvertcount<QNUM-3)
|
||||
{
|
||||
Bmemcpy(&qcolors[3*qvertcount],col1,sizeof(col1));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v1, 3*sizeof(GLfloat));
|
||||
Bmemcpy(&qcolors[3*qvertcount],col2,sizeof(col2));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v2, 3*sizeof(GLfloat));
|
||||
Bmemcpy(&qcolors[3*qvertcount],col3,sizeof(col3));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v3, 3*sizeof(GLfloat));
|
||||
Bmemcpy(&qcolors[3*qvertcount],col4,sizeof(col4));
|
||||
Bmemcpy(&qverts[3*qvertcount++],v4, 3*sizeof(GLfloat));
|
||||
|
||||
Bmemcpy(&qverts[3*qvertcount++],dummyvert, 3*sizeof(GLfloat));
|
||||
}
|
||||
Bmemcpy(&qverts[3*qvertcount++],dummyvert, 3*sizeof(GLfloat));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2036,156 +2047,165 @@ void polymer_alt_editorselect(void)
|
|||
{
|
||||
_prsector *s = prsectors[i];
|
||||
sectortype *sec = §or[i];
|
||||
|
||||
if (!s->flags.uptodate)
|
||||
continue;
|
||||
|
||||
_prplane *cfp;
|
||||
int8_t what = 1;
|
||||
|
||||
if (!s->flags.uptodate)
|
||||
continue;
|
||||
|
||||
|
||||
for (what=1; what<=2; what++)
|
||||
{
|
||||
GLfloat *pl;
|
||||
GLdouble a, b, c, d;
|
||||
GLfloat scrv[3] = {x-viewx, y-viewy, z-viewz};
|
||||
|
||||
if (what==1)
|
||||
cfp = &s->ceil;
|
||||
else
|
||||
cfp = &s->floor;
|
||||
|
||||
GLfloat *pl = cfp->plane;
|
||||
GLdouble a=pl[0], b=pl[1], c=pl[2], d=pl[3];
|
||||
GLfloat scrv[3] = {x-viewx, y-viewy, z-viewz};
|
||||
pl = cfp->plane;
|
||||
|
||||
if (-dot3f(scrv,pl)<0)
|
||||
continue;
|
||||
|
||||
GLdouble nnormsq, nnorm, dist;
|
||||
nnormsq = a*a + b*b + c*c;
|
||||
nnorm = sqrt(nnormsq);
|
||||
a=pl[0], b=pl[1], c=pl[2], d=pl[3];
|
||||
|
||||
GLfloat coeff = -d/nnormsq;
|
||||
GLfloat pointonplane[3] = {coeff*a, coeff*b, coeff*c};
|
||||
GLfloat vec[3] = {x-pointonplane[0], y-pointonplane[1], z-pointonplane[2]};
|
||||
dist = fabs((a*vec[0] + b*vec[1] + c*vec[2])/nnorm);
|
||||
if (dist > bestdist)
|
||||
continue;
|
||||
|
||||
// projected point
|
||||
GLfloat p[2] =
|
||||
{
|
||||
//x,
|
||||
((b*b+c*c)*x - a*b*y - a*c*z - a*d)/nnormsq,
|
||||
|
||||
//y,
|
||||
//(-a*b*x + (a*a+c*c)*y - b*c*z - b*d)/nnormsq,
|
||||
|
||||
//z
|
||||
(-a*c*x - b*c*y + (a*a+b*b)*z - c*d)/nnormsq
|
||||
};
|
||||
|
||||
// implementation using a loop over all triangles
|
||||
for (j=0; j<s->indicescount; j+=3)
|
||||
{
|
||||
GLushort idx[3] = {cfp->indices[j], cfp->indices[j+1], cfp->indices[j+2]};
|
||||
GLfloat v1[2] = {cfp->buffer[(idx[0]*5)], cfp->buffer[(idx[0]*5)+2]};
|
||||
GLfloat v2[2] = {cfp->buffer[(idx[1]*5)], cfp->buffer[(idx[1]*5)+2]};
|
||||
GLfloat v3[2] = {cfp->buffer[(idx[2]*5)], cfp->buffer[(idx[2]*5)+2]};
|
||||
GLfloat v12[2] = {v2[0]-v1[0], v2[1]-v1[1]};
|
||||
GLfloat v23[2] = {v3[0]-v2[0], v3[1]-v2[1]};
|
||||
GLfloat v31[2] = {v1[0]-v3[0], v1[1]-v3[1]};
|
||||
int rotsign = (what==1)?-1:1;
|
||||
GLfloat v1p_r[2] = {rotsign*(p[1]-v1[1]), -rotsign*(p[0]-v1[0])};
|
||||
GLfloat v2p_r[2] = {rotsign*(p[1]-v2[1]), -rotsign*(p[0]-v2[0])};
|
||||
GLfloat v3p_r[2] = {rotsign*(p[1]-v3[1]), -rotsign*(p[0]-v3[0])};
|
||||
GLdouble nnormsq = a*a + b*b + c*c;
|
||||
GLdouble nnorm = sqrt(nnormsq);
|
||||
GLfloat coeff = -d/nnormsq;
|
||||
GLfloat pointonplane[3] = {coeff*a, coeff*b, coeff*c};
|
||||
GLfloat vec[3] = {x-pointonplane[0], y-pointonplane[1], z-pointonplane[2]};
|
||||
GLdouble dist = fabs((a*vec[0] + b*vec[1] + c*vec[2])/nnorm);
|
||||
|
||||
if (dist > bestdist)
|
||||
continue;
|
||||
|
||||
if (dot2f(v12,v12)>0.25 && dot2f(v23,v23)>0.25 && dot2f(v31,v31)>0.25
|
||||
&& dot2f(v12,v1p_r) < 0 && dot2f(v23,v2p_r) < 0 && dot2f(v31,v3p_r) < 0)
|
||||
{
|
||||
// projected point
|
||||
GLfloat p[2] =
|
||||
{
|
||||
//x,
|
||||
((b*b+c*c)*x - a*b*y - a*c*z - a*d)/nnormsq,
|
||||
|
||||
//y,
|
||||
//(-a*b*x + (a*a+c*c)*y - b*c*z - b*d)/nnormsq,
|
||||
|
||||
//z
|
||||
(-a*c*x - b*c*y + (a*a+b*b)*z - c*d)/nnormsq
|
||||
};
|
||||
|
||||
// implementation using a loop over all triangles
|
||||
for (j=0; j<s->indicescount; j+=3)
|
||||
{
|
||||
GLushort idx[3] = {cfp->indices[j], cfp->indices[j+1], cfp->indices[j+2]};
|
||||
GLfloat v1[2] = {cfp->buffer[(idx[0]*5)], cfp->buffer[(idx[0]*5)+2]};
|
||||
GLfloat v2[2] = {cfp->buffer[(idx[1]*5)], cfp->buffer[(idx[1]*5)+2]};
|
||||
GLfloat v3[2] = {cfp->buffer[(idx[2]*5)], cfp->buffer[(idx[2]*5)+2]};
|
||||
GLfloat v12[2] = {v2[0]-v1[0], v2[1]-v1[1]};
|
||||
GLfloat v23[2] = {v3[0]-v2[0], v3[1]-v2[1]};
|
||||
GLfloat v31[2] = {v1[0]-v3[0], v1[1]-v3[1]};
|
||||
int rotsign = (what==1)?-1:1;
|
||||
GLfloat v1p_r[2] = {rotsign*(p[1]-v1[1]), -rotsign*(p[0]-v1[0])};
|
||||
GLfloat v2p_r[2] = {rotsign*(p[1]-v2[1]), -rotsign*(p[0]-v2[0])};
|
||||
GLfloat v3p_r[2] = {rotsign*(p[1]-v3[1]), -rotsign*(p[0]-v3[0])};
|
||||
|
||||
if (dot2f(v12,v12)>0.25 && dot2f(v23,v23)>0.25 && dot2f(v31,v31)>0.25
|
||||
&& dot2f(v12,v1p_r) < 0 && dot2f(v23,v2p_r) < 0 && dot2f(v31,v3p_r) < 0)
|
||||
{
|
||||
bestwhat = what;
|
||||
bestsec = i;
|
||||
bestdist = dist;
|
||||
#ifdef M32_SHOWDEBUG
|
||||
if (qvertcount<QNUM-3)
|
||||
{
|
||||
Bmemcpy(&qcolors[3*qvertcount],col1,sizeof(col1));
|
||||
qverts[(3*qvertcount)+0] = v1[0];
|
||||
qverts[(3*qvertcount)+1] = cfp->buffer[(idx[0]*5+1)];
|
||||
qverts[(3*qvertcount)+2] = v1[1];
|
||||
qvertcount++;
|
||||
|
||||
Bmemcpy(&qcolors[3*qvertcount],col2,sizeof(col1));
|
||||
qverts[(3*qvertcount)+0] = v2[0];
|
||||
qverts[(3*qvertcount)+1] = cfp->buffer[(idx[1]*5+1)];
|
||||
qverts[(3*qvertcount)+2] = v2[1];
|
||||
qvertcount++;
|
||||
|
||||
Bmemcpy(&qcolors[3*qvertcount],col3,sizeof(col1));
|
||||
qverts[(3*qvertcount)+0] = v3[0];
|
||||
qverts[(3*qvertcount)+1] = cfp->buffer[(idx[2]*5+1)];
|
||||
qverts[(3*qvertcount)+2] = v3[1];
|
||||
qvertcount++;
|
||||
|
||||
Bmemcpy(&qverts[3*qvertcount++],dummyvert, 3*sizeof(GLfloat));
|
||||
}
|
||||
#endif
|
||||
goto nextsector;
|
||||
}
|
||||
} // loop over triangles
|
||||
/*
|
||||
// implementation using inside() (less precise)
|
||||
if (inside(-p[1],p[0],i))
|
||||
{
|
||||
bestwhat = what;
|
||||
bestsec = i;
|
||||
bestdist = dist;
|
||||
#ifdef M32_SHOWDEBUG
|
||||
if (qvertcount<QNUM-3)
|
||||
{
|
||||
Bmemcpy(&qcolors[3*qvertcount],col1,sizeof(col1));
|
||||
qverts[(3*qvertcount)+0] = v1[0];
|
||||
qverts[(3*qvertcount)+1] = cfp->buffer[(idx[0]*5+1)];
|
||||
qverts[(3*qvertcount)+2] = v1[1];
|
||||
qvertcount++;
|
||||
|
||||
Bmemcpy(&qcolors[3*qvertcount],col2,sizeof(col1));
|
||||
qverts[(3*qvertcount)+0] = v2[0];
|
||||
qverts[(3*qvertcount)+1] = cfp->buffer[(idx[1]*5+1)];
|
||||
qverts[(3*qvertcount)+2] = v2[1];
|
||||
qvertcount++;
|
||||
|
||||
Bmemcpy(&qcolors[3*qvertcount],col3,sizeof(col1));
|
||||
qverts[(3*qvertcount)+0] = v3[0];
|
||||
qverts[(3*qvertcount)+1] = cfp->buffer[(idx[2]*5+1)];
|
||||
qverts[(3*qvertcount)+2] = v3[1];
|
||||
qvertcount++;
|
||||
|
||||
Bmemcpy(&qverts[3*qvertcount++],dummyvert, 3*sizeof(GLfloat));
|
||||
}
|
||||
#endif
|
||||
goto nextsector;
|
||||
}
|
||||
} // loop over triangles
|
||||
/*
|
||||
// implementation using inside() (less precise)
|
||||
if (inside(-p[1],p[0],i))
|
||||
{
|
||||
bestwhat = what;
|
||||
bestsec = i;
|
||||
bestdist = dist;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
nextsector:
|
||||
if (bestsec==i)
|
||||
{
|
||||
int16_t k, bestk=0;
|
||||
GLfloat bestwdistsq = 1e60, wdistsq, wnorm;
|
||||
GLfloat w1[2], w2[2], w21[2], pw1[2], pw2[2];
|
||||
GLfloat ptonline[2];
|
||||
GLfloat scrvxz[2]={scrv[0],scrv[2]};
|
||||
GLfloat scrvxznorm, scrvxzn[2];
|
||||
GLfloat w1d, w2d;
|
||||
walltype *wal = &wall[sec->wallptr];
|
||||
for (k=0; k<sec->wallnum; k++)
|
||||
{
|
||||
w1[1] = -wal[k].x;
|
||||
w1[0] = wal[k].y;
|
||||
w2[1] = -wall[wal[k].point2].x;
|
||||
w2[0] = wall[wal[k].point2].y;
|
||||
|
||||
scrvxznorm = sqrt(dot2f(scrvxz,scrvxz));
|
||||
scrvxzn[0] = scrvxz[1]/scrvxznorm;
|
||||
scrvxzn[1] = -scrvxz[0]/scrvxznorm;
|
||||
|
||||
relvec2f(p,w1, pw1);
|
||||
relvec2f(p,w2, pw2);
|
||||
relvec2f(w2,w1, w21);
|
||||
w1d = dot2f(scrvxzn,pw1);
|
||||
w2d = dot2f(scrvxzn,pw2);
|
||||
w2d = -w2d;
|
||||
if (w1d < 0 || w2d < 0 || w1d + w2d < 0.01)
|
||||
continue;
|
||||
wnorm = sqrt(dot2f(w21,w21));
|
||||
ptonline[0] = w2[0]+(wnorm*w2d/(w1d+w2d))*w21[0];
|
||||
ptonline[1] = w2[1]+(wnorm*w2d/(w1d+w2d))*w21[1];
|
||||
|
||||
wdistsq = (ptonline[0]-p[0])*(ptonline[0]-p[0]) + (ptonline[1]-p[1])*(ptonline[1]-p[1]);
|
||||
if (wdistsq < bestwdistsq)
|
||||
if (bestsec==i)
|
||||
{
|
||||
bestk = k;
|
||||
bestwdistsq = wdistsq;
|
||||
}
|
||||
}
|
||||
bestwall = sec->wallptr+bestk;
|
||||
int16_t k, bestk=0;
|
||||
GLfloat bestwdistsq = FLT_MAX, wdistsq, wnorm;
|
||||
GLfloat w1[2], w2[2], w21[2], pw1[2], pw2[2];
|
||||
GLfloat ptonline[2];
|
||||
GLfloat scrvxz[2]={scrv[0],scrv[2]};
|
||||
GLfloat scrvxznorm, scrvxzn[2];
|
||||
GLfloat w1d, w2d;
|
||||
walltype *wal = &wall[sec->wallptr];
|
||||
for (k=0; k<sec->wallnum; k++)
|
||||
{
|
||||
w1[1] = -(float)wal[k].x;
|
||||
w1[0] = (float)wal[k].y;
|
||||
w2[1] = -(float)wall[wal[k].point2].x;
|
||||
w2[0] = (float)wall[wal[k].point2].y;
|
||||
|
||||
scrvxznorm = sqrt(dot2f(scrvxz,scrvxz));
|
||||
scrvxzn[0] = scrvxz[1]/scrvxznorm;
|
||||
scrvxzn[1] = -scrvxz[0]/scrvxznorm;
|
||||
|
||||
relvec2f(p,w1, pw1);
|
||||
relvec2f(p,w2, pw2);
|
||||
relvec2f(w2,w1, w21);
|
||||
w1d = dot2f(scrvxzn,pw1);
|
||||
w2d = dot2f(scrvxzn,pw2);
|
||||
w2d = -w2d;
|
||||
if (w1d < 0 || w2d < 0 || w1d + w2d < 0.01)
|
||||
continue;
|
||||
wnorm = sqrt(dot2f(w21,w21));
|
||||
ptonline[0] = w2[0]+(wnorm*w2d/(w1d+w2d))*w21[0];
|
||||
ptonline[1] = w2[1]+(wnorm*w2d/(w1d+w2d))*w21[1];
|
||||
|
||||
wdistsq = (ptonline[0]-p[0])*(ptonline[0]-p[0]) + (ptonline[1]-p[1])*(ptonline[1]-p[1]);
|
||||
if (wdistsq < bestwdistsq)
|
||||
{
|
||||
bestk = k;
|
||||
bestwdistsq = wdistsq;
|
||||
}
|
||||
}
|
||||
bestwall = sec->wallptr+bestk;
|
||||
#ifdef M32_SHOWDEBUG
|
||||
if (m32_numdebuglines<64)
|
||||
Bsprintf(m32_debugstr[m32_numdebuglines++], "what=sec %d, dist=%.02f, wall=%d", bestsec, bestdist, bestwall);
|
||||
if (m32_numdebuglines<64)
|
||||
Bsprintf(m32_debugstr[m32_numdebuglines++], "what=sec %d, dist=%.02f, wall=%d", bestsec, bestdist, bestwall);
|
||||
#endif
|
||||
} // determine searchwall
|
||||
} // ceiling or floor
|
||||
} // loop over sectors
|
||||
} // determine searchwall
|
||||
} // ceiling or floor
|
||||
} // loop over sectors
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// SECTORS
|
||||
|
@ -2270,12 +2290,12 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
|||
{
|
||||
if ((-wal->x != s->verts[(i*3)+2]))
|
||||
{
|
||||
s->verts[(i*3)+2] = s->floor.buffer[(i*5)+2] = s->ceil.buffer[(i*5)+2] = -wal->x;
|
||||
s->verts[(i*3)+2] = s->floor.buffer[(i*5)+2] = s->ceil.buffer[(i*5)+2] = -(float)wal->x;
|
||||
needfloor = wallinvalidate = 1;
|
||||
}
|
||||
if ((wal->y != s->verts[i*3]))
|
||||
{
|
||||
s->verts[i*3] = s->floor.buffer[i*5] = s->ceil.buffer[i*5] = wal->y;
|
||||
s->verts[i*3] = s->floor.buffer[i*5] = s->ceil.buffer[i*5] = (float)wal->y;
|
||||
needfloor = wallinvalidate = 1;
|
||||
}
|
||||
|
||||
|
@ -2362,11 +2382,11 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
|||
// relative texturing
|
||||
if (curstat & 64)
|
||||
{
|
||||
xpancoef = wal->x - wall[sec->wallptr].x;
|
||||
ypancoef = wall[sec->wallptr].y - wal->y;
|
||||
xpancoef = (float)(wal->x - wall[sec->wallptr].x);
|
||||
ypancoef = (float)(wall[sec->wallptr].y - wal->y);
|
||||
|
||||
tex = xpancoef * secangsin + ypancoef * secangcos;
|
||||
tey = xpancoef * secangcos - ypancoef * secangsin;
|
||||
tex = (int32_t)(xpancoef * secangsin + ypancoef * secangcos);
|
||||
tey = (int32_t)(xpancoef * secangcos - ypancoef * secangsin);
|
||||
} else {
|
||||
tex = wal->x;
|
||||
tey = -wal->y;
|
||||
|
@ -2374,12 +2394,12 @@ static int32_t polymer_updatesector(int16_t sectnum)
|
|||
|
||||
if ((curstat & (2+64)) == (2+64))
|
||||
{
|
||||
heidiff = curbuffer[(i*5)+1] - curbuffer[1];
|
||||
heidiff = (int32_t)(curbuffer[(i*5)+1] - curbuffer[1]);
|
||||
// don't forget the sign, tey could be negative with concave sectors
|
||||
if (tey >= 0)
|
||||
tey = sqrt((tey * tey) + (heidiff * heidiff));
|
||||
tey = (int32_t)sqrt((tey * tey) + (heidiff * heidiff));
|
||||
else
|
||||
tey = -sqrt((tey * tey) + (heidiff * heidiff));
|
||||
tey = -(int32_t)sqrt((tey * tey) + (heidiff * heidiff));
|
||||
}
|
||||
|
||||
if (curstat & 4)
|
||||
|
@ -2807,9 +2827,9 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
while (i < 4)
|
||||
{
|
||||
if ((i == 0) || (i == 3))
|
||||
dist = xref;
|
||||
dist = (float)xref;
|
||||
else
|
||||
dist = (xref == 0);
|
||||
dist = (float)(xref == 0);
|
||||
|
||||
w->wall.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + wal->xpanning) / (float)(tilesizx[curpicnum]);
|
||||
w->wall.buffer[(i * 5) + 4] = (-(float)(yref + (w->wall.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef;
|
||||
|
@ -2877,9 +2897,9 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
while (i < 4)
|
||||
{
|
||||
if ((i == 0) || (i == 3))
|
||||
dist = xref;
|
||||
dist = (float)xref;
|
||||
else
|
||||
dist = (xref == 0);
|
||||
dist = (float)(xref == 0);
|
||||
|
||||
w->wall.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + curxpanning) / (float)(tilesizx[curpicnum]);
|
||||
w->wall.buffer[(i * 5) + 4] = (-(float)(yref + (w->wall.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef;
|
||||
|
@ -2964,9 +2984,9 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
while (i < 4)
|
||||
{
|
||||
if ((i == 0) || (i == 3))
|
||||
dist = xref;
|
||||
dist = (float)xref;
|
||||
else
|
||||
dist = (xref == 0);
|
||||
dist = (float)(xref == 0);
|
||||
|
||||
w->over.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + wal->xpanning) / (float)(tilesizx[curpicnum]);
|
||||
w->over.buffer[(i * 5) + 4] = (-(float)(yref + (w->over.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef;
|
||||
|
@ -3017,9 +3037,9 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
while (i < 4)
|
||||
{
|
||||
if ((i == 0) || (i == 3))
|
||||
dist = xref;
|
||||
dist = (float)xref;
|
||||
else
|
||||
dist = (xref == 0);
|
||||
dist = (float)(xref == 0);
|
||||
|
||||
w->mask.buffer[(i * 5) + 3] = ((dist * 8.0f * wal->xrepeat) + wal->xpanning) / (float)(tilesizx[curpicnum]);
|
||||
w->mask.buffer[(i * 5) + 4] = (-(float)(yref + (w->mask.buffer[(i * 5) + 1] * 16)) / ((tilesizy[curpicnum] * 2048.0f) / (float)(wal->yrepeat))) + ypancoef;
|
||||
|
@ -3391,9 +3411,9 @@ static void polymer_drawsky(int16_t tilenum, char palnum, int8_t shade)
|
|||
float pos[3];
|
||||
pthtyp* pth;
|
||||
|
||||
pos[0] = globalposy;
|
||||
pos[0] = (float)globalposy;
|
||||
pos[1] = -(float)(globalposz) / 16.0f;
|
||||
pos[2] = -globalposx;
|
||||
pos[2] = -(float)globalposx;
|
||||
|
||||
bglPushMatrix();
|
||||
bglLoadIdentity();
|
||||
|
@ -3599,9 +3619,9 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
if ((pr_vbos > 1) && (m->indices == NULL))
|
||||
polymer_loadmodelvbos(m);
|
||||
|
||||
spos[0] = tspr->y;
|
||||
spos[0] = (float)tspr->y;
|
||||
spos[1] = -(float)(tspr->z) / 16.0f;
|
||||
spos[2] = -tspr->x;
|
||||
spos[2] = -(float)tspr->x;
|
||||
ang = (float)((tspr->ang+spriteext[tspr->owner].angoff) & 2047) / (2048.0f / 360.0f);
|
||||
ang -= 90.0f;
|
||||
if (((tspr->cstat>>4) & 3) == 2)
|
||||
|
@ -3723,11 +3743,11 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
if (tspr->cstat & 2)
|
||||
{
|
||||
if (!(tspr->cstat&512))
|
||||
color[3] = 0.66;
|
||||
color[3] = 0.66f;
|
||||
else
|
||||
color[3] = 0.33;
|
||||
color[3] = 0.33f;
|
||||
} else
|
||||
color[3] = 1.0;
|
||||
color[3] = 1.0f;
|
||||
|
||||
color[3] *= (1.0f - spriteext[tspr->owner].alpha);
|
||||
|
||||
|
@ -3777,9 +3797,9 @@ static void polymer_drawmdsprite(spritetype *tspr)
|
|||
|
||||
lradius = prlights[i].range / 1000.0f;
|
||||
|
||||
lpos[0] = prlights[i].y;
|
||||
lpos[1] = -prlights[i].z / 16.0f;
|
||||
lpos[2] = -prlights[i].x;
|
||||
lpos[0] = (float)prlights[i].y;
|
||||
lpos[1] = -(float)prlights[i].z / 16.0f;
|
||||
lpos[2] = -(float)prlights[i].x;
|
||||
|
||||
polymer_transformpoint(lpos, tlpos, rootmodelviewmatrix);
|
||||
|
||||
|
@ -4218,9 +4238,9 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights,
|
|||
{
|
||||
float pos[3], bias[2];
|
||||
|
||||
pos[0] = globalposy;
|
||||
pos[0] = (float)globalposy;
|
||||
pos[1] = -(float)(globalposz) / 16.0f;
|
||||
pos[2] = -globalposx;
|
||||
pos[2] = -(float)globalposx;
|
||||
|
||||
bglActiveTextureARB(texunit + GL_TEXTURE0_ARB);
|
||||
bglBindTexture(GL_TEXTURE_2D, material.normalmap);
|
||||
|
@ -4335,9 +4355,9 @@ static int32_t polymer_bindmaterial(_prmaterial material, int16_t* lights,
|
|||
float range[2];
|
||||
float color[4];
|
||||
|
||||
inpos[0] = prlights[lights[curlight]].y;
|
||||
inpos[1] = -prlights[lights[curlight]].z / 16.0f;
|
||||
inpos[2] = -prlights[lights[curlight]].x;
|
||||
inpos[0] = (float)prlights[lights[curlight]].y;
|
||||
inpos[1] = -(float)prlights[lights[curlight]].z / 16.0f;
|
||||
inpos[2] = -(float)prlights[lights[curlight]].x;
|
||||
|
||||
polymer_transformpoint(inpos, pos, curmodelviewmatrix);
|
||||
|
||||
|
@ -4738,9 +4758,9 @@ static int32_t polymer_planeinlight(_prplane* plane, _prlight* light)
|
|||
if (light->radius)
|
||||
return polymer_planeinfrustum(plane, light->frustum);
|
||||
|
||||
lightpos[0] = light->y;
|
||||
lightpos[1] = -light->z / 16.0f;
|
||||
lightpos[2] = -light->x;
|
||||
lightpos[0] = (float)light->y;
|
||||
lightpos[1] = -(float)light->z / 16.0f;
|
||||
lightpos[2] = -(float)light->x;
|
||||
|
||||
i = 0;
|
||||
|
||||
|
@ -4821,9 +4841,9 @@ static void polymer_processspotlight(_prlight* light)
|
|||
if ((light->horiz > 100) && (light->horiz < 110))
|
||||
light->horiz = 110;
|
||||
|
||||
lightpos[0] = light->y;
|
||||
lightpos[1] = -light->z / 16.0f;
|
||||
lightpos[2] = -light->x;
|
||||
lightpos[0] = (float)light->y;
|
||||
lightpos[1] = -(float)light->z / 16.0f;
|
||||
lightpos[2] = -(float)light->x;
|
||||
|
||||
// calculate the spot light transformations and matrices
|
||||
radius = (float)(light->radius) / (2048.0f / 360.0f);
|
||||
|
|
|
@ -6060,7 +6060,7 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c
|
|||
{
|
||||
#ifdef USELZF
|
||||
cleng = fastlz_compress(pic, miplen, packbuf/*, miplen-1*/);
|
||||
if (cleng == 0)
|
||||
if (cleng == 0 || cleng > j-1)
|
||||
{
|
||||
// failed to compress
|
||||
cleng = miplen;
|
||||
|
@ -6100,26 +6100,26 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c
|
|||
if (glusetexcachecompression)
|
||||
{
|
||||
#ifdef USELZF
|
||||
j = (miplen/stride)*8;
|
||||
j = (miplen/stride)<<3;
|
||||
cleng = fastlz_compress(midbuf,j,packbuf/*,j-1*/);
|
||||
if (cleng == 0)
|
||||
if (cleng == 0 || cleng > j-1)
|
||||
{
|
||||
cleng = j;
|
||||
writebuf = midbuf;
|
||||
}
|
||||
else writebuf = packbuf;
|
||||
#else
|
||||
cleng = lzwcompress(midbuf,(miplen/stride)*8,packbuf);
|
||||
writebuf = packbuf;
|
||||
cleng = lzwcompress(midbuf,(miplen/stride)*8,packbuf);
|
||||
writebuf = packbuf;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
cleng = (miplen/stride)*8;
|
||||
cleng = (miplen/stride)<<3;
|
||||
writebuf = midbuf;
|
||||
}
|
||||
j = B_LITTLE32(cleng);
|
||||
Bwrite(fil,&j,4);
|
||||
Bwrite(fil,&j,sizeof(j));
|
||||
Bwrite(fil,writebuf,cleng);
|
||||
}
|
||||
|
||||
|
@ -6131,26 +6131,26 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c
|
|||
if (glusetexcachecompression)
|
||||
{
|
||||
#ifdef USELZF
|
||||
j = (miplen/stride)*4;
|
||||
j = (miplen/stride)<<2;
|
||||
cleng = fastlz_compress(midbuf,j,packbuf/*,j-1*/);
|
||||
if (cleng == 0)
|
||||
if (cleng == 0 || cleng > j-1)
|
||||
{
|
||||
cleng = j;
|
||||
writebuf = midbuf;
|
||||
}
|
||||
else writebuf = packbuf;
|
||||
#else
|
||||
cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf);
|
||||
writebuf = packbuf;
|
||||
cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf);
|
||||
writebuf = packbuf;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
cleng = (miplen/stride)*4;
|
||||
cleng = (miplen/stride)<<2;
|
||||
writebuf = midbuf;
|
||||
}
|
||||
j = B_LITTLE32(cleng);
|
||||
Bwrite(fil,&j,4);
|
||||
Bwrite(fil,&j,sizeof(j));
|
||||
Bwrite(fil,writebuf,cleng);
|
||||
|
||||
//index_4x4
|
||||
|
@ -6167,26 +6167,26 @@ int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, c
|
|||
if (glusetexcachecompression)
|
||||
{
|
||||
#ifdef USELZF
|
||||
j = (miplen/stride)*4;
|
||||
j = (miplen/stride)<<2;
|
||||
cleng = fastlz_compress(midbuf,j,packbuf/*,j-1*/);
|
||||
if (cleng == 0)
|
||||
if (cleng == 0 || cleng > j-1)
|
||||
{
|
||||
cleng = j;
|
||||
writebuf = midbuf;
|
||||
}
|
||||
else writebuf = packbuf;
|
||||
#else
|
||||
cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf);
|
||||
writebuf = packbuf;
|
||||
cleng = lzwcompress(midbuf,(miplen/stride)*4,packbuf);
|
||||
writebuf = packbuf;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
cleng = (miplen/stride)*4;
|
||||
cleng = (miplen/stride)<<2;
|
||||
writebuf = midbuf;
|
||||
}
|
||||
j = B_LITTLE32(cleng);
|
||||
Bwrite(fil,&j,4);
|
||||
Bwrite(fil,&j,sizeof(j));
|
||||
Bwrite(fil,writebuf,cleng);
|
||||
#endif
|
||||
return 0;
|
||||
|
|
|
@ -204,7 +204,7 @@ SKIPWALLCHECK:
|
|||
|
||||
if (s->picnum == RPG && sj->extra > 0)
|
||||
ActorExtra[j].picnum = RPG;
|
||||
else if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE) && ActorExtra[i].projectile.workslike & PROJECTILE_RADIUS_PICNUM && sj->extra > 0)
|
||||
else if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE) && SpriteProjectile[i].workslike & PROJECTILE_RADIUS_PICNUM && sj->extra > 0)
|
||||
ActorExtra[j].picnum = s->picnum;
|
||||
else
|
||||
{
|
||||
|
@ -648,7 +648,9 @@ inline void G_AddGameLight(int32_t radius, int32_t srcsprite, int32_t zoffset, i
|
|||
|
||||
if (ActorExtra[srcsprite].lightptr == NULL)
|
||||
{
|
||||
#pragma pack(push,1)
|
||||
_prlight mylight;
|
||||
#pragma pack(pop)
|
||||
|
||||
mylight.sector = s->sectnum;
|
||||
mylight.x = s->x;
|
||||
|
@ -780,6 +782,8 @@ static void G_MoveZombieActors(void)
|
|||
case RECON__STATIC:
|
||||
CS |= 257;
|
||||
default:
|
||||
if (A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384)
|
||||
break;
|
||||
ActorExtra[i].timetosleep = 0;
|
||||
A_PlayAlertSound(i);
|
||||
changespritestat(i, STAT_ACTOR);
|
||||
|
@ -861,7 +865,7 @@ int32_t A_IncurDamage(int32_t sn)
|
|||
}
|
||||
}
|
||||
|
||||
if (A_CheckSpriteTileFlags(ActorExtra[sn].picnum,SPRITE_PROJECTILE) && (ActorExtra[sn].projectile.workslike & PROJECTILE_RPG))
|
||||
if (A_CheckSpriteTileFlags(ActorExtra[sn].picnum,SPRITE_PROJECTILE) && (ActorExtra[sn].projectile->workslike & PROJECTILE_RPG))
|
||||
{
|
||||
g_player[p].ps->posxv +=
|
||||
ActorExtra[sn].extra*(sintable[(ActorExtra[sn].ang+512)&2047])<<2;
|
||||
|
@ -2360,33 +2364,33 @@ static void G_MoveWeapons(void)
|
|||
{
|
||||
/* Custom projectiles. This is a big hack. */
|
||||
|
||||
if (ActorExtra[i].projectile.pal >= 0)
|
||||
s->pal=ActorExtra[i].projectile.pal;
|
||||
if (SpriteProjectile[i].pal >= 0)
|
||||
s->pal=SpriteProjectile[i].pal;
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_KNEE)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_KNEE)
|
||||
KILLIT(i);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_RPG)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_RPG)
|
||||
{
|
||||
// if (ActorExtra[i].projectile.workslike & COOLEXPLOSION1)
|
||||
// if (SpriteProjectile[i].workslike & COOLEXPLOSION1)
|
||||
// if( g_sounds[WIERDSHOT_FLY].num == 0 )
|
||||
// A_PlaySound(WIERDSHOT_FLY,i);
|
||||
|
||||
Bmemcpy(&davect,s,sizeof(vec3_t));
|
||||
|
||||
if (ActorExtra[i].projectile.flashcolor)
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, ActorExtra[i].projectile.flashcolor,PR_LIGHT_PRIO_LOW_GAME);
|
||||
if (SpriteProjectile[i].flashcolor)
|
||||
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 2048, SpriteProjectile[i].flashcolor,PR_LIGHT_PRIO_LOW_GAME);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
{
|
||||
/* if(s->yvel < 1 || s->extra < 2 || (s->xvel|s->zvel) == 0)
|
||||
Did this cause the bug with prematurely exploding projectiles? */
|
||||
if (s->yvel < 1)
|
||||
{
|
||||
|
||||
if (ActorExtra[i].projectile.spawns >= 0)
|
||||
if (SpriteProjectile[i].spawns >= 0)
|
||||
{
|
||||
k = A_Spawn(i,ActorExtra[i].projectile.spawns);
|
||||
k = A_Spawn(i,SpriteProjectile[i].spawns);
|
||||
|
||||
// Bmemcpy(&sprite[k],&davect,sizeof(vec3_t));
|
||||
/*
|
||||
|
@ -2395,21 +2399,21 @@ static void G_MoveWeapons(void)
|
|||
sprite[k].z = daz;
|
||||
*/
|
||||
|
||||
if (ActorExtra[i].projectile.sxrepeat > 4)
|
||||
sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat;
|
||||
if (ActorExtra[i].projectile.syrepeat > 4)
|
||||
sprite[k].yrepeat=ActorExtra[i].projectile.syrepeat;
|
||||
if (SpriteProjectile[i].sxrepeat > 4)
|
||||
sprite[k].xrepeat=SpriteProjectile[i].sxrepeat;
|
||||
if (SpriteProjectile[i].syrepeat > 4)
|
||||
sprite[k].yrepeat=SpriteProjectile[i].syrepeat;
|
||||
}
|
||||
if (ActorExtra[i].projectile.isound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.isound,i);
|
||||
if (SpriteProjectile[i].isound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].isound,i);
|
||||
|
||||
s->extra=ActorExtra[i].projectile.extra;
|
||||
s->extra=SpriteProjectile[i].extra;
|
||||
|
||||
if (ActorExtra[i].projectile.extra_rand > 0)
|
||||
s->extra += (krand()&ActorExtra[i].projectile.extra_rand);
|
||||
if (SpriteProjectile[i].extra_rand > 0)
|
||||
s->extra += (krand()&SpriteProjectile[i].extra_rand);
|
||||
|
||||
x = s->extra;
|
||||
A_RadiusDamage(i,ActorExtra[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x);
|
||||
A_RadiusDamage(i,SpriteProjectile[i].hitradius, x>>2,x>>1,x-(x>>2),x);
|
||||
|
||||
KILLIT(i);
|
||||
}
|
||||
|
@ -2417,16 +2421,16 @@ static void G_MoveWeapons(void)
|
|||
|
||||
p = -1;
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_COOLEXPLOSION1)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_COOLEXPLOSION1)
|
||||
{
|
||||
s->shade++;
|
||||
if (s->shade >= 40) KILLIT(i);
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.drop)
|
||||
s->zvel -= ActorExtra[i].projectile.drop;
|
||||
if (SpriteProjectile[i].drop)
|
||||
s->zvel -= SpriteProjectile[i].drop;
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_SPIT)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_SPIT)
|
||||
if (s->zvel < 6144)
|
||||
s->zvel += g_spriteGravity-112;
|
||||
|
||||
|
@ -2442,21 +2446,21 @@ static void G_MoveWeapons(void)
|
|||
A_GetZLimits(i);
|
||||
qq = CLIPMASK1;
|
||||
|
||||
if (ActorExtra[i].projectile.trail >= 0)
|
||||
if (SpriteProjectile[i].trail >= 0)
|
||||
{
|
||||
for (f=0; f<=ActorExtra[i].projectile.tnum; f++)
|
||||
for (f=0; f<=SpriteProjectile[i].tnum; f++)
|
||||
{
|
||||
j = A_Spawn(i,ActorExtra[i].projectile.trail);
|
||||
if (ActorExtra[i].projectile.toffset != 0)
|
||||
sprite[j].z += (ActorExtra[i].projectile.toffset<<8);
|
||||
if (ActorExtra[i].projectile.txrepeat >= 0)
|
||||
sprite[j].xrepeat=ActorExtra[i].projectile.txrepeat;
|
||||
if (ActorExtra[i].projectile.tyrepeat >= 0)
|
||||
sprite[j].yrepeat=ActorExtra[i].projectile.tyrepeat;
|
||||
j = A_Spawn(i,SpriteProjectile[i].trail);
|
||||
if (SpriteProjectile[i].toffset != 0)
|
||||
sprite[j].z += (SpriteProjectile[i].toffset<<8);
|
||||
if (SpriteProjectile[i].txrepeat >= 0)
|
||||
sprite[j].xrepeat=SpriteProjectile[i].txrepeat;
|
||||
if (SpriteProjectile[i].tyrepeat >= 0)
|
||||
sprite[j].yrepeat=SpriteProjectile[i].tyrepeat;
|
||||
}
|
||||
}
|
||||
|
||||
for (f=1; f<=ActorExtra[i].projectile.velmult; f++)
|
||||
for (f=1; f<=SpriteProjectile[i].velmult; f++)
|
||||
{
|
||||
vec3_t tmpvect;
|
||||
Bmemcpy(&davect,s,sizeof(vec3_t));
|
||||
|
@ -2470,7 +2474,7 @@ static void G_MoveWeapons(void)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!(ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS) &&
|
||||
if (!(SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) &&
|
||||
s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS)
|
||||
if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256)
|
||||
j = 49152|s->yvel;
|
||||
|
@ -2482,45 +2486,45 @@ static void G_MoveWeapons(void)
|
|||
KILLIT(i);
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_TIMED && ActorExtra[i].projectile.range > 0)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_TIMED && SpriteProjectile[i].range > 0)
|
||||
{
|
||||
if (!(ActorExtra[i].temp_data[8]))
|
||||
ActorExtra[i].temp_data[8] = 1;
|
||||
else
|
||||
ActorExtra[i].temp_data[8]++;
|
||||
|
||||
if (ActorExtra[i].temp_data[8] > ActorExtra[i].projectile.range)
|
||||
if (ActorExtra[i].temp_data[8] > SpriteProjectile[i].range)
|
||||
{
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_EXPLODEONTIMER)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_EXPLODEONTIMER)
|
||||
{
|
||||
if (ActorExtra[i].projectile.spawns >= 0)
|
||||
if (SpriteProjectile[i].spawns >= 0)
|
||||
{
|
||||
k = A_Spawn(i,ActorExtra[i].projectile.spawns);
|
||||
k = A_Spawn(i,SpriteProjectile[i].spawns);
|
||||
|
||||
Bmemcpy(&sprite[k],&davect,sizeof(vec3_t));
|
||||
|
||||
if (ActorExtra[i].projectile.sxrepeat > 4)
|
||||
sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat;
|
||||
if (ActorExtra[i].projectile.syrepeat > 4)
|
||||
sprite[k].yrepeat=ActorExtra[i].projectile.syrepeat;
|
||||
if (SpriteProjectile[i].sxrepeat > 4)
|
||||
sprite[k].xrepeat=SpriteProjectile[i].sxrepeat;
|
||||
if (SpriteProjectile[i].syrepeat > 4)
|
||||
sprite[k].yrepeat=SpriteProjectile[i].syrepeat;
|
||||
}
|
||||
if (ActorExtra[i].projectile.isound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.isound,i);
|
||||
if (SpriteProjectile[i].isound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].isound,i);
|
||||
|
||||
s->extra=ActorExtra[i].projectile.extra;
|
||||
s->extra=SpriteProjectile[i].extra;
|
||||
|
||||
if (ActorExtra[i].projectile.extra_rand > 0)
|
||||
s->extra += (krand()&ActorExtra[i].projectile.extra_rand);
|
||||
if (SpriteProjectile[i].extra_rand > 0)
|
||||
s->extra += (krand()&SpriteProjectile[i].extra_rand);
|
||||
|
||||
x = s->extra;
|
||||
A_RadiusDamage(i,ActorExtra[i].projectile.hitradius, x>>2,x>>1,x-(x>>2),x);
|
||||
A_RadiusDamage(i,SpriteProjectile[i].hitradius, x>>2,x>>1,x-(x>>2),x);
|
||||
}
|
||||
KILLIT(i);
|
||||
}
|
||||
}
|
||||
|
||||
if ((j&49152) != 49152)
|
||||
if (!(ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS))
|
||||
if (!(SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS))
|
||||
{
|
||||
if (s->z < ActorExtra[i].ceilingz)
|
||||
{
|
||||
|
@ -2536,13 +2540,13 @@ static void G_MoveWeapons(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_WATERBUBBLES &&
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_WATERBUBBLES &&
|
||||
sector[s->sectnum].lotag == 2 && rnd(140))
|
||||
A_Spawn(i,WATERBUBBLE);
|
||||
|
||||
if (j != 0)
|
||||
{
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_COOLEXPLOSION1)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_COOLEXPLOSION1)
|
||||
{
|
||||
s->xvel = 0;
|
||||
s->zvel = 0;
|
||||
|
@ -2552,22 +2556,22 @@ static void G_MoveWeapons(void)
|
|||
{
|
||||
j &= (MAXSPRITES-1);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFSPRITES)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFSPRITES)
|
||||
{
|
||||
s->yvel--;
|
||||
|
||||
k = getangle(sprite[j].x-s->x,sprite[j].y-s->y)+(sprite[j].cstat&16?0:512);
|
||||
s->ang = ((k<<1) - s->ang)&2047;
|
||||
|
||||
if (ActorExtra[i].projectile.bsound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.bsound,i);
|
||||
if (SpriteProjectile[i].bsound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].bsound,i);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_LOSESVELOCITY)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_LOSESVELOCITY)
|
||||
{
|
||||
s->xvel=s->xvel>>1;
|
||||
s->zvel=s->zvel>>1;
|
||||
}
|
||||
if (!(ActorExtra[i].projectile.workslike & PROJECTILE_FORCEIMPACT))goto BOLT;
|
||||
if (!(SpriteProjectile[i].workslike & PROJECTILE_FORCEIMPACT))goto BOLT;
|
||||
}
|
||||
|
||||
A_DamageObject(j,i);
|
||||
|
@ -2577,7 +2581,7 @@ static void G_MoveWeapons(void)
|
|||
p = sprite[j].yvel;
|
||||
A_PlaySound(PISTOL_BODYHIT,j);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_SPIT)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_SPIT)
|
||||
{
|
||||
g_player[p].ps->horiz += 32;
|
||||
g_player[p].ps->return_to_center = 8;
|
||||
|
@ -2599,32 +2603,32 @@ static void G_MoveWeapons(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_RPG_IMPACT)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_RPG_IMPACT)
|
||||
{
|
||||
|
||||
ActorExtra[j].owner = s->owner;
|
||||
ActorExtra[j].picnum = s->picnum;
|
||||
ActorExtra[j].extra += ActorExtra[i].projectile.extra;
|
||||
ActorExtra[j].extra += SpriteProjectile[i].extra;
|
||||
|
||||
if (ActorExtra[i].projectile.spawns >= 0)
|
||||
if (SpriteProjectile[i].spawns >= 0)
|
||||
{
|
||||
k = A_Spawn(i,ActorExtra[i].projectile.spawns);
|
||||
k = A_Spawn(i,SpriteProjectile[i].spawns);
|
||||
Bmemcpy(&sprite[k],&davect,sizeof(vec3_t));
|
||||
|
||||
if (ActorExtra[i].projectile.sxrepeat > 4)
|
||||
sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat;
|
||||
if (ActorExtra[i].projectile.syrepeat > 4)
|
||||
sprite[k].yrepeat=ActorExtra[i].projectile.syrepeat;
|
||||
if (SpriteProjectile[i].sxrepeat > 4)
|
||||
sprite[k].xrepeat=SpriteProjectile[i].sxrepeat;
|
||||
if (SpriteProjectile[i].syrepeat > 4)
|
||||
sprite[k].yrepeat=SpriteProjectile[i].syrepeat;
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.isound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.isound,i);
|
||||
if (SpriteProjectile[i].isound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].isound,i);
|
||||
|
||||
if (!(ActorExtra[i].projectile.workslike & PROJECTILE_FORCEIMPACT))
|
||||
if (!(SpriteProjectile[i].workslike & PROJECTILE_FORCEIMPACT))
|
||||
KILLIT(i);
|
||||
|
||||
}
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_FORCEIMPACT)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_FORCEIMPACT)
|
||||
goto BOLT;
|
||||
|
||||
}
|
||||
|
@ -2632,7 +2636,7 @@ static void G_MoveWeapons(void)
|
|||
{
|
||||
j &= (MAXWALLS-1);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFMIRRORS &&
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFMIRRORS &&
|
||||
(wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
||||
{
|
||||
k = getangle(
|
||||
|
@ -2648,7 +2652,7 @@ static void G_MoveWeapons(void)
|
|||
setsprite(i,&davect);
|
||||
A_DamageWall(i,j,(vec3_t *)s,s->picnum);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
{
|
||||
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
|
||||
s->yvel--;
|
||||
|
@ -2658,10 +2662,10 @@ static void G_MoveWeapons(void)
|
|||
wall[wall[j].point2].y-wall[j].y);
|
||||
s->ang = ((k<<1) - s->ang)&2047;
|
||||
|
||||
if (ActorExtra[i].projectile.bsound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.bsound,i);
|
||||
if (SpriteProjectile[i].bsound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].bsound,i);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_LOSESVELOCITY)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_LOSESVELOCITY)
|
||||
{
|
||||
s->xvel=s->xvel>>1;
|
||||
s->zvel=s->zvel>>1;
|
||||
|
@ -2682,17 +2686,17 @@ static void G_MoveWeapons(void)
|
|||
Sect_DamageCeiling(s->sectnum);
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS)
|
||||
{
|
||||
A_DoProjectileBounce(i);
|
||||
A_SetSprite(i,qq);
|
||||
|
||||
s->yvel--;
|
||||
|
||||
if (ActorExtra[i].projectile.bsound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.bsound,i);
|
||||
if (SpriteProjectile[i].bsound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].bsound,i);
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_LOSESVELOCITY)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_LOSESVELOCITY)
|
||||
{
|
||||
s->xvel=s->xvel>>1;
|
||||
s->zvel=s->zvel>>1;
|
||||
|
@ -2702,7 +2706,7 @@ static void G_MoveWeapons(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_HITSCAN)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_HITSCAN)
|
||||
{
|
||||
if (!actorscrptr[sprite[i].picnum])
|
||||
goto BOLT;
|
||||
|
@ -2711,27 +2715,27 @@ static void G_MoveWeapons(void)
|
|||
goto BOLT;
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.workslike & PROJECTILE_RPG)
|
||||
if (SpriteProjectile[i].workslike & PROJECTILE_RPG)
|
||||
{
|
||||
if (ActorExtra[i].projectile.spawns > 0)
|
||||
if (SpriteProjectile[i].spawns > 0)
|
||||
{
|
||||
k = A_Spawn(i,ActorExtra[i].projectile.spawns);
|
||||
k = A_Spawn(i,SpriteProjectile[i].spawns);
|
||||
Bmemcpy(&sprite[k],&davect,sizeof(vec3_t));
|
||||
|
||||
if (ActorExtra[i].projectile.sxrepeat > 4)
|
||||
sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat;
|
||||
if (ActorExtra[i].projectile.syrepeat > 4)
|
||||
sprite[k].yrepeat=ActorExtra[i].projectile.syrepeat;
|
||||
if (SpriteProjectile[i].sxrepeat > 4)
|
||||
sprite[k].xrepeat=SpriteProjectile[i].sxrepeat;
|
||||
if (SpriteProjectile[i].syrepeat > 4)
|
||||
sprite[k].yrepeat=SpriteProjectile[i].syrepeat;
|
||||
}
|
||||
|
||||
if (ActorExtra[i].projectile.isound >= 0)
|
||||
A_PlaySound(ActorExtra[i].projectile.isound,i);
|
||||
if (SpriteProjectile[i].isound >= 0)
|
||||
A_PlaySound(SpriteProjectile[i].isound,i);
|
||||
|
||||
s->extra=ActorExtra[i].projectile.extra;
|
||||
if (ActorExtra[i].projectile.extra_rand > 0)
|
||||
s->extra += (krand()&ActorExtra[i].projectile.extra_rand);
|
||||
s->extra=SpriteProjectile[i].extra;
|
||||
if (SpriteProjectile[i].extra_rand > 0)
|
||||
s->extra += (krand()&SpriteProjectile[i].extra_rand);
|
||||
|
||||
A_RadiusDamage(i,ActorExtra[i].projectile.hitradius,
|
||||
A_RadiusDamage(i,SpriteProjectile[i].hitradius,
|
||||
s->extra>>2,s->extra>>1,s->extra-(s->extra>>2),s->extra);
|
||||
KILLIT(i);
|
||||
}
|
||||
|
@ -6583,87 +6587,87 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
j = nextspritesect[j];
|
||||
}
|
||||
|
||||
if (t[0]) if (t[0]) //If in motion
|
||||
if (t[0]) //If in motion
|
||||
{
|
||||
if (klabs(sc->floorz-t[2]) <= SP)
|
||||
{
|
||||
if (klabs(sc->floorz-t[2]) <= SP)
|
||||
{
|
||||
G_ActivateWarpElevators(i,0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (t[0]==-1)
|
||||
{
|
||||
if (sc->floorz > t[3])
|
||||
break;
|
||||
}
|
||||
else if (sc->ceilingz < t[4]) break;
|
||||
|
||||
if (t[1] == 0) break;
|
||||
t[1] = 0;
|
||||
|
||||
j = headspritestat[STAT_EFFECTOR];
|
||||
while (j >= 0)
|
||||
{
|
||||
if (i != j && (sprite[j].lotag) == 17)
|
||||
if ((sc->hitag-t[0]) ==
|
||||
(sector[sprite[j].sectnum].hitag)
|
||||
&& sh == (sprite[j].hitag))
|
||||
break;
|
||||
j = nextspritestat[j];
|
||||
}
|
||||
|
||||
if (j == -1) break;
|
||||
|
||||
k = headspritesect[s->sectnum];
|
||||
while (k >= 0)
|
||||
{
|
||||
nextk = nextspritesect[k];
|
||||
|
||||
if (sprite[k].statnum == 10 && sprite[k].owner >= 0)
|
||||
{
|
||||
p = sprite[k].yvel;
|
||||
|
||||
g_player[p].ps->posx += sprite[j].x-s->x;
|
||||
g_player[p].ps->posy += sprite[j].y-s->y;
|
||||
g_player[p].ps->posz = sector[sprite[j].sectnum].floorz-(sc->floorz-g_player[p].ps->posz);
|
||||
|
||||
ActorExtra[k].floorz = sector[sprite[j].sectnum].floorz;
|
||||
ActorExtra[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
||||
|
||||
g_player[p].ps->bobposx = g_player[p].ps->oposx = g_player[p].ps->posx;
|
||||
g_player[p].ps->bobposy = g_player[p].ps->oposy = g_player[p].ps->posy;
|
||||
g_player[p].ps->oposz = g_player[p].ps->posz;
|
||||
|
||||
g_player[p].ps->truefz = ActorExtra[k].floorz;
|
||||
g_player[p].ps->truecz = ActorExtra[k].ceilingz;
|
||||
g_player[p].ps->bobcounter = 0;
|
||||
|
||||
changespritesect(k,sprite[j].sectnum);
|
||||
g_player[p].ps->cursectnum = sprite[j].sectnum;
|
||||
}
|
||||
else if (sprite[k].statnum != 3)
|
||||
{
|
||||
sprite[k].x +=
|
||||
sprite[j].x-s->x;
|
||||
sprite[k].y +=
|
||||
sprite[j].y-s->y;
|
||||
sprite[k].z = sector[sprite[j].sectnum].floorz-
|
||||
(sc->floorz-sprite[k].z);
|
||||
|
||||
ActorExtra[k].bposx = sprite[k].x;
|
||||
ActorExtra[k].bposy = sprite[k].y;
|
||||
ActorExtra[k].bposz = sprite[k].z;
|
||||
|
||||
changespritesect(k,sprite[j].sectnum);
|
||||
setsprite(k,(vec3_t *)&sprite[k]);
|
||||
|
||||
ActorExtra[k].floorz = sector[sprite[j].sectnum].floorz;
|
||||
ActorExtra[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
||||
|
||||
}
|
||||
k = nextk;
|
||||
}
|
||||
G_ActivateWarpElevators(i,0);
|
||||
break;
|
||||
}
|
||||
|
||||
if (t[0]==-1)
|
||||
{
|
||||
if (sc->floorz > t[3])
|
||||
break;
|
||||
}
|
||||
else if (sc->ceilingz < t[4]) break;
|
||||
|
||||
if (t[1] == 0) break;
|
||||
t[1] = 0;
|
||||
|
||||
j = headspritestat[STAT_EFFECTOR];
|
||||
while (j >= 0)
|
||||
{
|
||||
if (i != j && (sprite[j].lotag) == 17)
|
||||
if ((sc->hitag-t[0]) ==
|
||||
(sector[sprite[j].sectnum].hitag)
|
||||
&& sh == (sprite[j].hitag))
|
||||
break;
|
||||
j = nextspritestat[j];
|
||||
}
|
||||
|
||||
if (j == -1) break;
|
||||
|
||||
k = headspritesect[s->sectnum];
|
||||
while (k >= 0)
|
||||
{
|
||||
nextk = nextspritesect[k];
|
||||
|
||||
if (sprite[k].statnum == 10 && sprite[k].owner >= 0)
|
||||
{
|
||||
p = sprite[k].yvel;
|
||||
|
||||
g_player[p].ps->posx += sprite[j].x-s->x;
|
||||
g_player[p].ps->posy += sprite[j].y-s->y;
|
||||
g_player[p].ps->posz = sector[sprite[j].sectnum].floorz-(sc->floorz-g_player[p].ps->posz);
|
||||
|
||||
ActorExtra[k].floorz = sector[sprite[j].sectnum].floorz;
|
||||
ActorExtra[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
||||
|
||||
g_player[p].ps->bobposx = g_player[p].ps->oposx = g_player[p].ps->posx;
|
||||
g_player[p].ps->bobposy = g_player[p].ps->oposy = g_player[p].ps->posy;
|
||||
g_player[p].ps->oposz = g_player[p].ps->posz;
|
||||
|
||||
g_player[p].ps->truefz = ActorExtra[k].floorz;
|
||||
g_player[p].ps->truecz = ActorExtra[k].ceilingz;
|
||||
g_player[p].ps->bobcounter = 0;
|
||||
|
||||
changespritesect(k,sprite[j].sectnum);
|
||||
g_player[p].ps->cursectnum = sprite[j].sectnum;
|
||||
}
|
||||
else if (sprite[k].statnum != 3)
|
||||
{
|
||||
sprite[k].x +=
|
||||
sprite[j].x-s->x;
|
||||
sprite[k].y +=
|
||||
sprite[j].y-s->y;
|
||||
sprite[k].z = sector[sprite[j].sectnum].floorz-
|
||||
(sc->floorz-sprite[k].z);
|
||||
|
||||
ActorExtra[k].bposx = sprite[k].x;
|
||||
ActorExtra[k].bposy = sprite[k].y;
|
||||
ActorExtra[k].bposz = sprite[k].z;
|
||||
|
||||
changespritesect(k,sprite[j].sectnum);
|
||||
setsprite(k,(vec3_t *)&sprite[k]);
|
||||
|
||||
ActorExtra[k].floorz = sector[sprite[j].sectnum].floorz;
|
||||
ActorExtra[k].ceilingz = sector[sprite[j].sectnum].ceilingz;
|
||||
|
||||
}
|
||||
k = nextk;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 18:
|
||||
|
@ -7570,29 +7574,20 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
#ifdef POLYMER
|
||||
case 49:
|
||||
{
|
||||
if (getrendermode() == 4)
|
||||
if (!A_CheckSpriteFlags(i, SPRITE_NOLIGHT) && getrendermode() == 4 &&
|
||||
!(A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384))
|
||||
{
|
||||
if (ActorExtra[i].lightptr == NULL)
|
||||
{
|
||||
#pragma pack(push,1)
|
||||
_prlight mylight;
|
||||
|
||||
#pragma pack(pop)
|
||||
mylight.sector = SECT;
|
||||
mylight.x = SX;
|
||||
mylight.y = SY;
|
||||
mylight.z = SZ;
|
||||
Bmemcpy(&mylight, &sprite[i], sizeof(int32_t) * 3);
|
||||
mylight.range = SHT;
|
||||
if ((sprite[i].xvel | sprite[i].yvel | sprite[i].zvel) != 0)
|
||||
{
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
}
|
||||
else
|
||||
{
|
||||
mylight.color[0] = hictinting[PL].r;
|
||||
mylight.color[1] = hictinting[PL].g;
|
||||
mylight.color[2] = hictinting[PL].b;
|
||||
}
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
mylight.radius = 0;
|
||||
mylight.angle = SA;
|
||||
mylight.horiz = SH;
|
||||
|
@ -7626,31 +7621,23 @@ static void G_MoveEffectors(void) //STATNUM 3
|
|||
}
|
||||
case 50:
|
||||
{
|
||||
if (getrendermode() == 4)
|
||||
if (!A_CheckSpriteFlags(i, SPRITE_NOLIGHT) && getrendermode() == 4 &&
|
||||
!(A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384))
|
||||
{
|
||||
if (ActorExtra[i].lightptr == NULL)
|
||||
{
|
||||
#pragma pack(push,1)
|
||||
_prlight mylight;
|
||||
#pragma pack(pop)
|
||||
|
||||
mylight.sector = SECT;
|
||||
mylight.x = SX;
|
||||
mylight.y = SY;
|
||||
mylight.z = SZ;
|
||||
Bmemcpy(&mylight, &sprite[i], sizeof(int32_t) * 3);
|
||||
mylight.range = SHT;
|
||||
if ((sprite[i].xvel | sprite[i].yvel | sprite[i].zvel) != 0)
|
||||
{
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
}
|
||||
else
|
||||
{
|
||||
mylight.color[0] = hictinting[PL].r;
|
||||
mylight.color[1] = hictinting[PL].g;
|
||||
mylight.color[2] = hictinting[PL].b;
|
||||
}
|
||||
mylight.color[0] = sprite[i].xvel;
|
||||
mylight.color[1] = sprite[i].yvel;
|
||||
mylight.color[2] = sprite[i].zvel;
|
||||
mylight.radius = (256-(SS+128))<<1;
|
||||
mylight.faderadius = (int16_t)(mylight.radius * 0.75);
|
||||
mylight.faderadius = (int16_t)(mylight.radius * 0.75f);
|
||||
mylight.angle = SA;
|
||||
mylight.horiz = SH;
|
||||
mylight.minshade = sprite[i].xoffset;
|
||||
|
@ -7913,7 +7900,8 @@ void G_MoveWorld(void)
|
|||
{
|
||||
spritetype *s = &sprite[i];
|
||||
|
||||
if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT))
|
||||
if ((sprite[i].picnum != SECTOREFFECTOR && (s->cstat & 32768)) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) ||
|
||||
(A_CheckSpriteFlags(i, SPRITE_USEACTIVATOR) && sector[sprite[i].sectnum].lotag & 16384))
|
||||
{
|
||||
if (ActorExtra[i].lightptr != NULL)
|
||||
{
|
||||
|
|
|
@ -227,7 +227,7 @@ void create_map_snapshot(void)
|
|||
{
|
||||
mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors);
|
||||
mapstate->sectsiz = j = fastlz_compress(§or[0], sizeof(sectortype) * numsectors,
|
||||
&mapstate->sectors[0]/*, sizeof(sectortype) * numsectors*/);
|
||||
&mapstate->sectors[0]/*, sizeof(sectortype) * numsectors*/);
|
||||
mapstate->sectors = (sectortype *)Brealloc(mapstate->sectors, j);
|
||||
mapstate->sectcrc = tempcrc;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ void create_map_snapshot(void)
|
|||
{
|
||||
mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls);
|
||||
mapstate->wallsiz = j = fastlz_compress(&wall[0], sizeof(walltype) * numwalls,
|
||||
&mapstate->walls[0]/*, sizeof(walltype) * numwalls*/);
|
||||
&mapstate->walls[0]/*, sizeof(walltype) * numwalls*/);
|
||||
mapstate->walls = (walltype *)Brealloc(mapstate->walls, j);
|
||||
mapstate->wallcrc = tempcrc;
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void create_map_snapshot(void)
|
|||
}
|
||||
}
|
||||
mapstate->spritesiz = j = fastlz_compress(&tspri[0], sizeof(spritetype) * numsprites,
|
||||
&mapstate->sprites[0]/*, sizeof(spritetype) * numsprites*/);
|
||||
&mapstate->sprites[0]/*, sizeof(spritetype) * numsprites*/);
|
||||
mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j);
|
||||
mapstate->spritecrc = tempcrc;
|
||||
Bfree(tspri);
|
||||
|
|
|
@ -261,10 +261,10 @@ void A_DeleteSprite(int32_t s);
|
|||
#pragma pack(push,1)
|
||||
|
||||
typedef struct {
|
||||
uint32_t bits;
|
||||
int16_t fvel, svel;
|
||||
int8_t avel, horz;
|
||||
char extbits;
|
||||
uint32_t bits; // 4b
|
||||
int16_t fvel, svel; // 4b
|
||||
int8_t avel, horz; // 2b
|
||||
int8_t extbits, filler; // 2b
|
||||
} input_t;
|
||||
|
||||
#define sync dsync // JBF 20040604: sync is a function on some platforms
|
||||
|
@ -278,14 +278,14 @@ typedef struct {
|
|||
} SOUNDOWNER;
|
||||
|
||||
typedef struct {
|
||||
int32_t length, num, soundsiz;
|
||||
char *filename, *ptr, *filename1;
|
||||
SOUNDOWNER SoundOwner[4];
|
||||
int16_t ps,pe,vo;
|
||||
char pr,m;
|
||||
volatile char lock;
|
||||
int32_t length, num, soundsiz; // 12b
|
||||
char *filename, *ptr, *filename1; // 12b/24b
|
||||
SOUNDOWNER SoundOwner[4]; // 32b
|
||||
int16_t ps,pe,vo; // 6b
|
||||
char pr,m; // 2b
|
||||
} sound_t;
|
||||
|
||||
extern volatile char g_soundlocks[MAXSOUNDS];
|
||||
extern sound_t g_sounds[MAXSOUNDS];
|
||||
|
||||
typedef struct {
|
||||
|
@ -310,69 +310,9 @@ struct savehead {
|
|||
int32_t numplr,volnum,levnum,plrskl;
|
||||
char boardfn[BMAX_PATH];
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int32_t UseJoystick;
|
||||
int32_t UseMouse;
|
||||
int32_t RunMode;
|
||||
int32_t AutoAim;
|
||||
int32_t ShowOpponentWeapons;
|
||||
int32_t MouseDeadZone,MouseBias;
|
||||
int32_t SmoothInput;
|
||||
|
||||
// JBF 20031211: Store the input settings because
|
||||
// (currently) jmact can't regurgitate them
|
||||
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
|
||||
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
|
||||
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
|
||||
int32_t MouseAnalogueScale[MAXMOUSEAXES];
|
||||
int32_t JoystickFunctions[MAXJOYBUTTONS][2];
|
||||
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
|
||||
int32_t JoystickAnalogueAxes[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueScale[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueDead[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
|
||||
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
|
||||
|
||||
//
|
||||
// Sound variables
|
||||
//
|
||||
int32_t FXDevice;
|
||||
int32_t MusicDevice;
|
||||
int32_t FXVolume;
|
||||
int32_t MusicVolume;
|
||||
int32_t SoundToggle;
|
||||
int32_t MusicToggle;
|
||||
int32_t VoiceToggle;
|
||||
int32_t AmbienceToggle;
|
||||
|
||||
int32_t NumVoices;
|
||||
int32_t NumChannels;
|
||||
int32_t NumBits;
|
||||
int32_t MixRate;
|
||||
|
||||
int32_t ReverseStereo;
|
||||
|
||||
//
|
||||
// Screen variables
|
||||
//
|
||||
|
||||
int32_t ScreenMode;
|
||||
|
||||
int32_t ScreenWidth;
|
||||
int32_t ScreenHeight;
|
||||
int32_t ScreenBPP;
|
||||
|
||||
int32_t ForceSetup;
|
||||
int32_t NoAutoLoad;
|
||||
|
||||
int32_t scripthandle;
|
||||
int32_t setupread;
|
||||
|
||||
int32_t CheckForUpdates;
|
||||
int32_t LastUpdateCheck;
|
||||
int32_t useprecache;
|
||||
} config_t;
|
||||
#pragma pack(pop)
|
||||
// the following struct is never saved off anywhere
|
||||
// so we don't need to fuck with its packing
|
||||
|
||||
typedef struct {
|
||||
int32_t camerax,cameray,cameraz;
|
||||
|
@ -410,9 +350,72 @@ typedef struct {
|
|||
char display_bonus_screen;
|
||||
char show_level_text;
|
||||
|
||||
config_t config;
|
||||
struct {
|
||||
int32_t UseJoystick;
|
||||
int32_t UseMouse;
|
||||
int32_t RunMode;
|
||||
int32_t AutoAim;
|
||||
int32_t ShowOpponentWeapons;
|
||||
int32_t MouseDeadZone,MouseBias;
|
||||
int32_t SmoothInput;
|
||||
|
||||
// JBF 20031211: Store the input settings because
|
||||
// (currently) jmact can't regurgitate them
|
||||
int32_t MouseFunctions[MAXMOUSEBUTTONS][2];
|
||||
int32_t MouseDigitalFunctions[MAXMOUSEAXES][2];
|
||||
int32_t MouseAnalogueAxes[MAXMOUSEAXES];
|
||||
int32_t MouseAnalogueScale[MAXMOUSEAXES];
|
||||
int32_t JoystickFunctions[MAXJOYBUTTONS][2];
|
||||
int32_t JoystickDigitalFunctions[MAXJOYAXES][2];
|
||||
int32_t JoystickAnalogueAxes[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueScale[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueDead[MAXJOYAXES];
|
||||
int32_t JoystickAnalogueSaturate[MAXJOYAXES];
|
||||
uint8_t KeyboardKeys[NUMGAMEFUNCTIONS][2];
|
||||
|
||||
//
|
||||
// Sound variables
|
||||
//
|
||||
int32_t FXDevice;
|
||||
int32_t MusicDevice;
|
||||
int32_t FXVolume;
|
||||
int32_t MusicVolume;
|
||||
int32_t SoundToggle;
|
||||
int32_t MusicToggle;
|
||||
int32_t VoiceToggle;
|
||||
int32_t AmbienceToggle;
|
||||
|
||||
int32_t NumVoices;
|
||||
int32_t NumChannels;
|
||||
int32_t NumBits;
|
||||
int32_t MixRate;
|
||||
|
||||
int32_t ReverseStereo;
|
||||
|
||||
//
|
||||
// Screen variables
|
||||
//
|
||||
|
||||
int32_t ScreenMode;
|
||||
|
||||
int32_t ScreenWidth;
|
||||
int32_t ScreenHeight;
|
||||
int32_t ScreenBPP;
|
||||
|
||||
int32_t ForceSetup;
|
||||
int32_t NoAutoLoad;
|
||||
|
||||
int32_t scripthandle;
|
||||
int32_t setupread;
|
||||
|
||||
int32_t CheckForUpdates;
|
||||
int32_t LastUpdateCheck;
|
||||
int32_t useprecache;
|
||||
} config;
|
||||
} user_defs;
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
typedef struct {
|
||||
int32_t ox,oy,oz;
|
||||
int16_t oa,os;
|
||||
|
@ -523,9 +526,15 @@ extern char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH];
|
|||
extern int16_t camsprite;
|
||||
|
||||
typedef struct {
|
||||
int32_t workslike, extra, cstat, extra_rand, hitradius, range, flashcolor;
|
||||
int16_t spawns, sound, isound, vel, decal, trail, tnum, drop, clipdist, offset, bounces, bsound, toffset;
|
||||
int8_t sxrepeat, syrepeat, txrepeat, tyrepeat, shade, xrepeat, yrepeat, pal, velmult;
|
||||
int32_t workslike, extra, cstat, extra_rand; // 16b
|
||||
int32_t hitradius, range, flashcolor; // 12b
|
||||
int16_t spawns, sound, isound, vel; // 8b
|
||||
int16_t decal, trail, tnum, drop; // 8b
|
||||
int16_t clipdist, offset, bounces, bsound; // 8b
|
||||
int16_t toffset; // 2b
|
||||
int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b
|
||||
int8_t shade, xrepeat, yrepeat, pal; // 4b
|
||||
int8_t velmult, filler; // 2b
|
||||
} projectile_t;
|
||||
|
||||
// extern char gotz;
|
||||
|
@ -540,24 +549,27 @@ typedef struct {
|
|||
// spriteinterpolate sprpos[MAXSPRITES];
|
||||
|
||||
typedef struct {
|
||||
int32_t bposx,bposy,bposz;
|
||||
int32_t floorz,ceilingz,lastvx,lastvy;
|
||||
int32_t flags,lasttransport,shootzvel;
|
||||
intptr_t temp_data[10]; // sometimes used to hold pointers to con code
|
||||
int16_t picnum,ang,extra,owner,movflag;
|
||||
int16_t tempang,actorstayput,dispicnum;
|
||||
int16_t timetosleep;
|
||||
char cgg;
|
||||
char filler;
|
||||
projectile_t projectile;
|
||||
int16_t lightId;
|
||||
int16_t lightcount; // how many tics until light is killed
|
||||
int16_t lightmaxrange;
|
||||
int32_t bposx,bposy,bposz,flags; //16b
|
||||
int32_t floorz,ceilingz,lastvx,lastvy; //16b
|
||||
int32_t lasttransport; //4b
|
||||
|
||||
int16_t timetosleep, shootzvel; //4b
|
||||
|
||||
intptr_t temp_data[10]; // 40b/80b sometimes used to hold pointers to con code
|
||||
|
||||
int16_t picnum,ang,extra,owner; //8b
|
||||
int16_t movflag,tempang,actorstayput,dispicnum; //8b
|
||||
int16_t lightId, lightcount, lightmaxrange, cgg; //8b
|
||||
|
||||
#ifdef POLYMER
|
||||
_prlight *lightptr;
|
||||
_prlight *lightptr; //4b/8b
|
||||
#else
|
||||
void *lightptr;
|
||||
#endif
|
||||
|
||||
int8_t filler[16]; // pad struct to 128 bytes
|
||||
|
||||
projectile_t *projectile; //4b/8b
|
||||
} ActorData_t;
|
||||
|
||||
extern ActorData_t ActorExtra[MAXSPRITES];
|
||||
|
@ -655,6 +667,8 @@ extern int16_t myangbak[MOVEFIFOSIZ];
|
|||
extern int16_t BlimpSpawnSprites[15];
|
||||
|
||||
//DUKE3D.H:
|
||||
|
||||
#pragma pack(pop)
|
||||
typedef struct {
|
||||
int16_t got_access, last_extra, shield_amount, curr_weapon, holoduke_on;
|
||||
int16_t firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
|
||||
|
@ -662,9 +676,10 @@ typedef struct {
|
|||
int16_t last_weapon, weapon_pos, kickback_pic;
|
||||
int16_t ammo_amount[MAX_WEAPONS], frag[MAXPLAYERS];
|
||||
char inven_icon, jetpack_on, heat_on, gotweapon[MAX_WEAPONS];
|
||||
} STATUSBARTYPE;
|
||||
} DukeStatus_t;
|
||||
#pragma pack(push,1)
|
||||
|
||||
extern STATUSBARTYPE sbar;
|
||||
extern DukeStatus_t sbar;
|
||||
extern int32_t g_cameraDistance, g_cameraClock, g_playerFriction,g_showShareware;
|
||||
extern int32_t g_networkBroadcastMode, g_movesPerPacket;
|
||||
extern int32_t g_gameQuit;
|
||||
|
@ -839,15 +854,15 @@ typedef struct {
|
|||
intptr_t *plValues; // array of values when 'per-player', or 'per-actor'
|
||||
} val;
|
||||
intptr_t lDefault;
|
||||
uint32_t dwFlags;
|
||||
uintptr_t dwFlags;
|
||||
char *szLabel;
|
||||
} gamevar_t;
|
||||
|
||||
typedef struct {
|
||||
char *szLabel;
|
||||
int32_t *plValues; // array of values
|
||||
int32_t size;
|
||||
char bReset;
|
||||
intptr_t size;
|
||||
intptr_t bReset;
|
||||
} gamearray_t;
|
||||
|
||||
extern gamevar_t aGameVars[MAXGAMEVARS];
|
||||
|
@ -867,6 +882,7 @@ enum SpriteFlags_t {
|
|||
SPRITE_NOPAL = 64,
|
||||
SPRITE_NOEVENTCODE = 128,
|
||||
SPRITE_NOLIGHT = 256,
|
||||
SPRITE_USEACTIVATOR = 512,
|
||||
};
|
||||
|
||||
extern int16_t SpriteCacheList[MAXTILES][3];
|
||||
|
@ -885,7 +901,7 @@ extern char g_bEnhanced; // are we 'enhanced' (more minerals, etc)
|
|||
|
||||
extern char g_szBuf[1024];
|
||||
|
||||
#define NAM_GRENADE_LIFETIME 120
|
||||
#define NAM_GRENADE_LIFETIME 120
|
||||
#define NAM_GRENADE_LIFETIME_VAR 30
|
||||
|
||||
extern intptr_t *aplWeaponClip[MAX_WEAPONS]; // number of items in clip
|
||||
|
@ -961,7 +977,7 @@ enum ProjectileFlags_t {
|
|||
PROJECTILE_FORCEIMPACT = 262144
|
||||
};
|
||||
|
||||
extern projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES];
|
||||
extern projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES];
|
||||
|
||||
// logo control
|
||||
|
||||
|
@ -996,39 +1012,42 @@ extern char setupfilename[BMAX_PATH];
|
|||
typedef struct {
|
||||
// this needs to have a copy of everything related to the map/actor state
|
||||
// see savegame.c
|
||||
int16_t numwalls;
|
||||
walltype wall[MAXWALLS];
|
||||
int16_t numsectors;
|
||||
sectortype sector[MAXSECTORS];
|
||||
spritetype sprite[MAXSPRITES];
|
||||
spriteext_t spriteext[MAXSPRITES];
|
||||
int16_t headspritesect[MAXSECTORS+1];
|
||||
int16_t prevspritesect[MAXSPRITES];
|
||||
int16_t nextspritesect[MAXSPRITES];
|
||||
int16_t headspritestat[MAXSTATUS+1];
|
||||
int16_t prevspritestat[MAXSPRITES];
|
||||
int16_t nextspritestat[MAXSPRITES];
|
||||
int16_t g_numCyclers;
|
||||
int16_t cyclers[MAXCYCLERS][6];
|
||||
PlayerSpawn_t g_playerSpawnPoints[MAXPLAYERS];
|
||||
int16_t g_numAnimWalls;
|
||||
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
|
||||
animwalltype animwall[MAXANIMWALLS];
|
||||
int32_t msx[2048], msy[2048];
|
||||
int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
||||
uint8_t show2dsector[(MAXSECTORS+7)>>3];
|
||||
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
||||
ActorData_t ActorExtra[MAXSPRITES];
|
||||
int16_t pskyoff[MAXPSKYTILES], pskybits;
|
||||
int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount;
|
||||
int16_t animatesect[MAXANIMATES];
|
||||
int32_t animateptr[MAXANIMATES];
|
||||
uint8_t g_numPlayerSprites;
|
||||
uint8_t g_earthquakeTime;
|
||||
int32_t lockclock;
|
||||
int32_t msx[2048], msy[2048];
|
||||
int32_t randomseed, g_globalRandom;
|
||||
uint8_t scriptptrs[MAXSPRITES];
|
||||
intptr_t *vars[MAXGAMEVARS];
|
||||
|
||||
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos;
|
||||
int16_t animatesect[MAXANIMATES];
|
||||
int16_t cyclers[MAXCYCLERS][6];
|
||||
int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
||||
int16_t g_numAnimWalls;
|
||||
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
||||
int16_t g_numCyclers;
|
||||
int16_t headspritesect[MAXSECTORS+1];
|
||||
int16_t headspritestat[MAXSTATUS+1];
|
||||
int16_t nextspritesect[MAXSPRITES];
|
||||
int16_t nextspritestat[MAXSPRITES];
|
||||
int16_t numsectors;
|
||||
int16_t numwalls;
|
||||
int16_t prevspritesect[MAXSPRITES];
|
||||
int16_t prevspritestat[MAXSPRITES];
|
||||
int16_t pskyoff[MAXPSKYTILES], pskybits;
|
||||
|
||||
uint8_t g_earthquakeTime;
|
||||
uint8_t g_numPlayerSprites;
|
||||
uint8_t scriptptrs[MAXSPRITES];
|
||||
uint8_t show2dsector[(MAXSECTORS+7)>>3];
|
||||
|
||||
ActorData_t ActorExtra[MAXSPRITES];
|
||||
PlayerSpawn_t g_playerSpawnPoints[MAXPLAYERS];
|
||||
animwalltype animwall[MAXANIMWALLS];
|
||||
sectortype sector[MAXSECTORS];
|
||||
spriteext_t spriteext[MAXSPRITES];
|
||||
spritetype sprite[MAXSPRITES];
|
||||
walltype wall[MAXWALLS];
|
||||
} mapstate_t;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1181,7 +1181,7 @@ void faketimerhandler(void)
|
|||
}
|
||||
|
||||
TRAVERSE_CONNECT(i)
|
||||
g_player[i].myminlag = 0x7fffffff;
|
||||
g_player[i].myminlag = 0x7fffffff;
|
||||
}
|
||||
|
||||
osyn = (input_t *)&inputfifo[(g_player[myconnectindex].movefifoend-2)&(MOVEFIFOSIZ-1)][myconnectindex];
|
||||
|
@ -1253,7 +1253,7 @@ void faketimerhandler(void)
|
|||
g_player[connecthead].myminlag -= i; otherminlag += i;
|
||||
|
||||
TRAVERSE_CONNECT(i)
|
||||
g_player[i].myminlag = 0x7fffffff;
|
||||
g_player[i].myminlag = 0x7fffffff;
|
||||
}
|
||||
|
||||
packbuf[0] = PACKET_SLAVE_TO_MASTER;
|
||||
|
@ -1344,7 +1344,7 @@ void faketimerhandler(void)
|
|||
k = j;
|
||||
|
||||
TRAVERSE_CONNECT(i)
|
||||
j += g_player[i].playerquitflag + g_player[i].playerquitflag;
|
||||
j += g_player[i].playerquitflag + g_player[i].playerquitflag;
|
||||
|
||||
TRAVERSE_CONNECT(i)
|
||||
{
|
||||
|
@ -4594,6 +4594,8 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
|
|||
G_GameExit("Too many sprites spawned.");
|
||||
}
|
||||
|
||||
ActorExtra[i].projectile = &SpriteProjectile[i];
|
||||
|
||||
ActorExtra[i].bposx = s_x;
|
||||
ActorExtra[i].bposy = s_y;
|
||||
ActorExtra[i].bposz = s_z;
|
||||
|
@ -4709,6 +4711,8 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
ActorExtra[i].timetosleep = 0;
|
||||
ActorExtra[i].extra = -1;
|
||||
|
||||
ActorExtra[i].projectile = &SpriteProjectile[i];
|
||||
|
||||
ActorExtra[i].bposx = SX;
|
||||
ActorExtra[i].bposy = SY;
|
||||
ActorExtra[i].bposz = SZ;
|
||||
|
@ -6050,9 +6054,16 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
ror_protectedsectors[sp->sectnum] = 1;
|
||||
case 49:
|
||||
case 50:
|
||||
changespritestat(i, STAT_EFFECTOR);
|
||||
goto SPAWN_END;
|
||||
break;
|
||||
{
|
||||
int32_t j, nextj;
|
||||
|
||||
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], j, nextj)
|
||||
if (sprite[j].picnum == ACTIVATOR || sprite[j].picnum == ACTIVATORLOCKED)
|
||||
ActorExtra[i].flags |= SPRITE_USEACTIVATOR;
|
||||
}
|
||||
changespritestat(i, STAT_EFFECTOR);
|
||||
goto SPAWN_END;
|
||||
break;
|
||||
}
|
||||
|
||||
sp->yvel = sector[sect].extra;
|
||||
|
@ -11528,7 +11539,7 @@ MAIN_LOOP_RESTART:
|
|||
OSD_DispatchQueued();
|
||||
|
||||
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || ud.multimode > 1) &&
|
||||
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
|
||||
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
|
||||
continue;
|
||||
|
||||
if (g_player[myconnectindex].ps->gm & (MODE_EOL|MODE_RESTART))
|
||||
|
@ -11779,7 +11790,7 @@ void G_OpenDemoWrite(void)
|
|||
}
|
||||
|
||||
if ((frecfilep = fopen(d,"wb")) == NULL) return;
|
||||
fwrite(&dummylong,4,1,frecfilep);
|
||||
fwrite(&dummylong,sizeof(dummylong),1,frecfilep);
|
||||
fwrite(&ver,sizeof(uint8_t),1,frecfilep);
|
||||
fwrite((char *)&ud.volume_number,sizeof(uint8_t),1,frecfilep);
|
||||
fwrite((char *)&ud.level_number,sizeof(uint8_t),1,frecfilep);
|
||||
|
|
|
@ -490,6 +490,8 @@ const char *keyw[] =
|
|||
"savenn", // 344
|
||||
"copy", // 345
|
||||
"<null>", // 346 internal inversion function
|
||||
"sectorofwall", // 347
|
||||
"qstrncat", // 348
|
||||
"<null>"
|
||||
};
|
||||
|
||||
|
@ -1404,7 +1406,8 @@ static inline int32_t ispecial(const char c)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (c == ' ' || c == 0x0d)
|
||||
if (c == ' ' || c == 0x0d || c == '(' || c == ')' ||
|
||||
c == ',' || c == ';')
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -2970,20 +2973,13 @@ static int32_t C_ParseCommand(void)
|
|||
case CON_QSPRINTF:
|
||||
C_GetNextValue(LABEL_DEFINE);
|
||||
C_GetNextValue(LABEL_DEFINE);
|
||||
for (j=3; j>=0; j--)
|
||||
{
|
||||
if (C_GetKeyword() == -1)
|
||||
C_GetNextVar();
|
||||
else break;
|
||||
}
|
||||
|
||||
while (j > -1)
|
||||
{
|
||||
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
|
||||
*g_scriptPtr = 0;
|
||||
g_scriptPtr++;
|
||||
j--;
|
||||
}
|
||||
j = 0;
|
||||
|
||||
while (C_GetKeyword() == -1 && j < 32)
|
||||
C_GetNextVar(), j++;
|
||||
|
||||
*g_scriptPtr++ = CON_NULLOP + (g_lineNumber<<12);
|
||||
return 0;
|
||||
|
||||
case CON_ESPAWN:
|
||||
|
@ -3810,6 +3806,11 @@ static int32_t C_ParseCommand(void)
|
|||
break;
|
||||
}
|
||||
|
||||
case CON_SECTOROFWALL:
|
||||
C_GetNextVarType(GAMEVAR_READONLY);
|
||||
C_GetNextVar();
|
||||
return 0;
|
||||
|
||||
case CON_GETTICKS:
|
||||
if (C_CheckEventSync(g_currentEvent))
|
||||
{
|
||||
|
@ -4737,6 +4738,9 @@ repeatcase:
|
|||
return 1; // end of block
|
||||
break;
|
||||
|
||||
case CON_QSTRNCAT:
|
||||
C_GetManyVars(3);
|
||||
return 0;
|
||||
case CON_CHANGESPRITESTAT:
|
||||
case CON_CHANGESPRITESECT:
|
||||
case CON_ZSHOOTVAR:
|
||||
|
@ -5449,13 +5453,15 @@ repeatcase:
|
|||
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
|
||||
{
|
||||
if (*textptr == '%' && *(textptr+1) == 's')
|
||||
{
|
||||
initprintf("%s:%d: error: quote text contains string identifier.\n",g_szScriptFileName,g_lineNumber);
|
||||
g_numCompilerErrors++;
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
if (*textptr == '%' && *(textptr+1) == 's')
|
||||
{
|
||||
initprintf("%s:%d: error: quote text contains string identifier.\n",g_szScriptFileName,g_lineNumber);
|
||||
g_numCompilerErrors++;
|
||||
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
if (tw == CON_DEFINEQUOTE)
|
||||
*(ScriptQuotes[k]+i) = *textptr;
|
||||
else
|
||||
|
@ -5931,14 +5937,20 @@ static void C_InitProjectiles(void)
|
|||
int32_t i;
|
||||
struct
|
||||
{
|
||||
int32_t workslike, extra, cstat, extra_rand, hitradius, range, flashcolor;
|
||||
int16_t spawns, sound, isound, vel, decal, trail, tnum, drop, clipdist, offset, bounces, bsound, toffset;
|
||||
int8_t sxrepeat, syrepeat, txrepeat, tyrepeat, shade, xrepeat, yrepeat, pal, velmult;
|
||||
int32_t workslike, extra, cstat, extra_rand; // 16b
|
||||
int32_t hitradius, range, flashcolor; // 12b
|
||||
int16_t spawns, sound, isound, vel; // 8b
|
||||
int16_t decal, trail, tnum, drop; // 8b
|
||||
int16_t clipdist, offset, bounces, bsound; // 8b
|
||||
int16_t toffset; // 2b
|
||||
int8_t sxrepeat, syrepeat, txrepeat, tyrepeat; // 4b
|
||||
int8_t shade, xrepeat, yrepeat, pal; // 4b
|
||||
int8_t velmult, filler; // 2b
|
||||
} DefaultProjectile =
|
||||
{
|
||||
1, 100, -1, -1, 2048, 0, 0,
|
||||
SMALLSMOKE, -1, -1, 600, BULLETHOLE, -1, 0, 0, 32, 448, g_numFreezeBounces, PIPEBOMB_BOUNCE, 1,
|
||||
-1, -1, -1, -1, -96, 18, 18, 0, 1
|
||||
-1, -1, -1, -1, -96, 18, 18, 0, 1, 0
|
||||
};
|
||||
|
||||
// this will only happen if I forget to update this function...
|
||||
|
|
|
@ -904,6 +904,8 @@ enum ScriptKeywords_t
|
|||
CON_SAVENN, // 344
|
||||
CON_COPY, // 345
|
||||
CON_INV, // 346
|
||||
CON_SECTOROFWALL, // 347
|
||||
CON_QSTRNCAT, // 348
|
||||
CON_END
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -1632,6 +1632,7 @@ static int32_t X_DoExecute(register int32_t once)
|
|||
}
|
||||
|
||||
case CON_GETPNAME:
|
||||
case CON_QSTRNCAT:
|
||||
case CON_QSTRCAT:
|
||||
case CON_QSTRCPY:
|
||||
case CON_QGETSYSSTR:
|
||||
|
@ -1690,19 +1691,15 @@ static int32_t X_DoExecute(register int32_t once)
|
|||
}
|
||||
break;
|
||||
case CON_QSTRCAT:
|
||||
if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[i] ? j : i);
|
||||
break;
|
||||
}
|
||||
if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) /* && g_scriptSanityChecks */) goto nullquote;
|
||||
Bstrncat(ScriptQuotes[i],ScriptQuotes[j],(MAXQUOTELEN-1)-Bstrlen(ScriptQuotes[i]));
|
||||
break;
|
||||
case CON_QSTRNCAT:
|
||||
if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) /* && g_scriptSanityChecks */) goto nullquote;
|
||||
Bstrncat(ScriptQuotes[i],ScriptQuotes[j],Gv_GetVarX(*insptr++));
|
||||
break;
|
||||
case CON_QSTRCPY:
|
||||
if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) /* && g_scriptSanityChecks */)
|
||||
{
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[i] ? j : i);
|
||||
break;
|
||||
}
|
||||
if ((ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL) /* && g_scriptSanityChecks */) goto nullquote;
|
||||
Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]);
|
||||
break;
|
||||
case CON_CHANGESPRITESECT:
|
||||
|
@ -1710,6 +1707,10 @@ static int32_t X_DoExecute(register int32_t once)
|
|||
if ((j<0 || j>=numsectors) /* && g_scriptSanityChecks */) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j); break;}
|
||||
changespritesect(i,j);
|
||||
break;
|
||||
default:
|
||||
nullquote:
|
||||
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],ScriptQuotes[i] ? j : i);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3104,6 +3105,15 @@ static int32_t X_DoExecute(register int32_t once)
|
|||
}
|
||||
break;
|
||||
|
||||
case CON_SECTOROFWALL:
|
||||
insptr++;
|
||||
{
|
||||
int32_t j = *insptr++;
|
||||
|
||||
Gv_SetVarX(j, sectorofwall(Gv_GetVarX(*insptr++)));
|
||||
}
|
||||
break;
|
||||
|
||||
case CON_QSPRINTF:
|
||||
insptr++;
|
||||
{
|
||||
|
@ -3116,10 +3126,55 @@ static int32_t X_DoExecute(register int32_t once)
|
|||
}
|
||||
|
||||
{
|
||||
int32_t var1 = Gv_GetVarX(*insptr++), var2 = Gv_GetVarX(*insptr++);
|
||||
int32_t var3 = Gv_GetVarX(*insptr++), var4 = Gv_GetVarX(*insptr++);
|
||||
Bstrcpy(tempbuf,ScriptQuotes[sq]);
|
||||
Bsprintf(ScriptQuotes[dq],tempbuf,var1,var2,var3,var4);
|
||||
int32_t arg[32], i = 0, j = 0, k = 0;
|
||||
int32_t len = Bstrlen(ScriptQuotes[sq]);
|
||||
char tempbuf[MAXQUOTELEN];
|
||||
|
||||
while ((*insptr & 0xFFF) != CON_NULLOP)
|
||||
arg[i++] = Gv_GetVarX(*insptr++);
|
||||
|
||||
insptr++; // skip the NOP
|
||||
|
||||
i = 0;
|
||||
|
||||
do
|
||||
{
|
||||
while (k < len && j < MAXQUOTELEN && ScriptQuotes[sq][k] != '%')
|
||||
tempbuf[j++] = ScriptQuotes[sq][k++];
|
||||
|
||||
if (ScriptQuotes[sq][k] == '%')
|
||||
{
|
||||
k++;
|
||||
switch (ScriptQuotes[sq][k])
|
||||
{
|
||||
case 'l':
|
||||
k++;
|
||||
case 'd':
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
Bstrcat(tempbuf, itoa(arg[i++], buf, 10));
|
||||
j += Bstrlen(buf);
|
||||
k++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 's':
|
||||
Bstrcat(tempbuf, ScriptQuotes[arg[i]]);
|
||||
j += Bstrlen(ScriptQuotes[arg[i++]]);
|
||||
k++;
|
||||
break;
|
||||
|
||||
default:
|
||||
tempbuf[j++] = ScriptQuotes[sq][k++];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (k < len && j < MAXQUOTELEN);
|
||||
|
||||
tempbuf[j] = '\0';
|
||||
Bstrcpy(ScriptQuotes[dq], tempbuf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3441,6 +3496,7 @@ static int32_t X_DoExecute(register int32_t once)
|
|||
j = nextspritestat[j];
|
||||
}
|
||||
while (j>=0);
|
||||
|
||||
if (tw==CON_FINDNEARACTORZ || j == MAXSPRITES)
|
||||
break;
|
||||
}
|
||||
|
@ -4664,7 +4720,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
if (ActorExtra[vm.g_i].timetosleep > 1)
|
||||
ActorExtra[vm.g_i].timetosleep--;
|
||||
else if (ActorExtra[vm.g_i].timetosleep == 1)
|
||||
changespritestat(vm.g_i,2);
|
||||
changespritestat(vm.g_i,STAT_ZOMBIEACTOR);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
@ -4679,10 +4735,12 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
|
|||
}
|
||||
else if (ud.respawn_items == 1 && (vm.g_sp->cstat&32768)) return;
|
||||
|
||||
if (ActorExtra[vm.g_i].timetosleep > 1)
|
||||
if (A_CheckSpriteFlags(vm.g_i, SPRITE_USEACTIVATOR) && sector[vm.g_sp->sectnum].lotag & 16384)
|
||||
changespritestat(vm.g_i,STAT_ZOMBIEACTOR);
|
||||
else if (ActorExtra[vm.g_i].timetosleep > 1)
|
||||
ActorExtra[vm.g_i].timetosleep--;
|
||||
else if (ActorExtra[vm.g_i].timetosleep == 1)
|
||||
changespritestat(vm.g_i,2);
|
||||
changespritestat(vm.g_i,STAT_ZOMBIEACTOR);
|
||||
}
|
||||
|
||||
void G_SaveMapState(mapstate_t *save)
|
||||
|
|
|
@ -936,262 +936,262 @@ static void __fastcall X_AccessActiveProjectile(int32_t iSet, int32_t lVar1, int
|
|||
case PROJ_WORKSLIKE:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.workslike=lValue;
|
||||
SpriteProjectile[proj].workslike=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.workslike, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].workslike, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_SPAWNS:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.spawns=lValue;
|
||||
SpriteProjectile[proj].spawns=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.spawns, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].spawns, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_SXREPEAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.sxrepeat=lValue;
|
||||
SpriteProjectile[proj].sxrepeat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.sxrepeat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].sxrepeat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_SYREPEAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.syrepeat=lValue;
|
||||
SpriteProjectile[proj].syrepeat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.syrepeat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].syrepeat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_SOUND:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.sound=lValue;
|
||||
SpriteProjectile[proj].sound=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.sound, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].sound, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_ISOUND:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.isound=lValue;
|
||||
SpriteProjectile[proj].isound=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.isound, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].isound, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_VEL:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.vel=lValue;
|
||||
SpriteProjectile[proj].vel=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.vel, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].vel, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_EXTRA:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.extra=lValue;
|
||||
SpriteProjectile[proj].extra=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.extra, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].extra, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_DECAL:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.decal=lValue;
|
||||
SpriteProjectile[proj].decal=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.decal, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].decal, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_TRAIL:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.trail=lValue;
|
||||
SpriteProjectile[proj].trail=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.trail, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].trail, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_TXREPEAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.txrepeat=lValue;
|
||||
SpriteProjectile[proj].txrepeat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.txrepeat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].txrepeat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_TYREPEAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.tyrepeat=lValue;
|
||||
SpriteProjectile[proj].tyrepeat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.tyrepeat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].tyrepeat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_TOFFSET:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.toffset=lValue;
|
||||
SpriteProjectile[proj].toffset=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.toffset, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].toffset, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_TNUM:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.tnum=lValue;
|
||||
SpriteProjectile[proj].tnum=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.tnum, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].tnum, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_DROP:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.drop=lValue;
|
||||
SpriteProjectile[proj].drop=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.drop, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].drop, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_CSTAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.cstat=lValue;
|
||||
SpriteProjectile[proj].cstat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.cstat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].cstat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_CLIPDIST:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.clipdist=lValue;
|
||||
SpriteProjectile[proj].clipdist=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.clipdist, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].clipdist, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_SHADE:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.shade=lValue;
|
||||
SpriteProjectile[proj].shade=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.shade, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].shade, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_XREPEAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.xrepeat=lValue;
|
||||
SpriteProjectile[proj].xrepeat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.xrepeat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].xrepeat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_YREPEAT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.yrepeat=lValue;
|
||||
SpriteProjectile[proj].yrepeat=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.yrepeat, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].yrepeat, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_PAL:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.pal=lValue;
|
||||
SpriteProjectile[proj].pal=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.pal, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].pal, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_EXTRA_RAND:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.extra_rand=lValue;
|
||||
SpriteProjectile[proj].extra_rand=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.extra_rand, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].extra_rand, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_HITRADIUS:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.hitradius=lValue;
|
||||
SpriteProjectile[proj].hitradius=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.hitradius, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].hitradius, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_VEL_MULT:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.velmult=lValue;
|
||||
SpriteProjectile[proj].velmult=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.velmult, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].velmult, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_OFFSET:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.offset=lValue;
|
||||
SpriteProjectile[proj].offset=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.offset, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].offset, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_BOUNCES:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.bounces=lValue;
|
||||
SpriteProjectile[proj].bounces=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.bounces, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].bounces, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_BSOUND:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.bsound=lValue;
|
||||
SpriteProjectile[proj].bsound=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.bsound, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].bsound, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_RANGE:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.range=lValue;
|
||||
SpriteProjectile[proj].range=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.range, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].range, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
case PROJ_FLASH_COLOR:
|
||||
if (iSet)
|
||||
{
|
||||
ActorExtra[proj].projectile.flashcolor=lValue;
|
||||
SpriteProjectile[proj].flashcolor=lValue;
|
||||
return;
|
||||
}
|
||||
Gv_SetVar(lVar2, ActorExtra[proj].projectile.flashcolor, vm.g_i, vm.g_p);
|
||||
Gv_SetVar(lVar2, SpriteProjectile[proj].flashcolor, vm.g_i, vm.g_p);
|
||||
return;
|
||||
|
||||
default:
|
||||
|
|
|
@ -180,13 +180,13 @@ int32_t Gv_ReadSave(int32_t fil)
|
|||
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
|
||||
{
|
||||
// if (!MapInfo[i].savedstate->vars[j])
|
||||
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXPLAYERS,sizeof(intptr_t));
|
||||
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXPLAYERS,sizeof(intptr_t));
|
||||
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
|
||||
}
|
||||
else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR)
|
||||
{
|
||||
// if (!MapInfo[i].savedstate->vars[j])
|
||||
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXSPRITES,sizeof(intptr_t));
|
||||
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXSPRITES,sizeof(intptr_t));
|
||||
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,12 +56,9 @@ int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
|
|||
|
||||
int32_t g_currentMenu;
|
||||
|
||||
|
||||
#pragma pack(push,1)
|
||||
|
||||
map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
|
||||
sound_t g_sounds[ MAXSOUNDS ];
|
||||
#pragma pack(pop)
|
||||
volatile char g_soundlocks[MAXSOUNDS];
|
||||
|
||||
char EpisodeNames[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRAPNEL CITY" };
|
||||
char SkillNames[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };
|
||||
|
@ -169,7 +166,7 @@ int32_t g_damageCameras,g_freezerSelfDamage=0,g_tripbombLaserMode=0;
|
|||
int32_t g_networkBroadcastMode = 255, g_movesPerPacket = 1,g_gameQuit = 0,everyothertime;
|
||||
int32_t g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius,
|
||||
g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius;
|
||||
STATUSBARTYPE sbar;
|
||||
DukeStatus_t sbar;
|
||||
|
||||
int32_t mymaxlag, otherminlag, bufferjitter = 1;
|
||||
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
|
||||
|
@ -183,7 +180,7 @@ int32_t nextvoxid = 0;
|
|||
|
||||
int32_t SpriteFlags[MAXTILES];
|
||||
|
||||
projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES];
|
||||
projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES];
|
||||
|
||||
char CheatKeys[2] = { sc_D, sc_N };
|
||||
char setupfilename[BMAX_PATH]= SETUPFILENAME;
|
||||
|
|
|
@ -26,10 +26,10 @@ struct grpfile *foundgrps = NULL;
|
|||
static struct grpcache
|
||||
{
|
||||
struct grpcache *next;
|
||||
char name[BMAX_PATH+1];
|
||||
int32_t size;
|
||||
int32_t mtime;
|
||||
int32_t crcval;
|
||||
char name[BMAX_PATH];
|
||||
}
|
||||
*grpcache = NULL, *usedgrpcache = NULL;
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@ BEGIN
|
|||
CONTROL "&Polymer", IDCPOLYMER, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 203, 6, 40, 10
|
||||
|
||||
CONTROL "Input devices:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 20, 50, 8
|
||||
#if 0
|
||||
CONTROL "Mo&use", IDCINPUTMOUSE, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 22, 49, 8
|
||||
CONTROL "&Joystick", IDCINPUTJOY, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 22, 49, 8
|
||||
#endif
|
||||
CONTROL "", IDCINPUT, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 19, 86, 56
|
||||
CONTROL "&Game:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 35, 100, 8
|
||||
CONTROL "", IDCDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 45, 226, 43
|
||||
|
|
|
@ -585,7 +585,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
|||
if (hitinfo.hitwall >= 0 || hitinfo.hitsprite >= 0)
|
||||
{
|
||||
j = A_InsertSprite(hitinfo.hitsect,hitinfo.pos.x,hitinfo.pos.y,hitinfo.pos.z,atwith,-15,0,0,sa,32,0,i,4);
|
||||
ActorExtra[j].projectile.workslike = ProjectileData[sprite[j].picnum].workslike;
|
||||
ActorExtra[j].projectile->workslike = ProjectileData[sprite[j].picnum].workslike;
|
||||
sprite[j].extra = ProjectileData[atwith].extra;
|
||||
if (ProjectileData[atwith].extra_rand > 0)
|
||||
sprite[j].extra += (krand()&ProjectileData[atwith].extra_rand);
|
||||
|
@ -4458,7 +4458,7 @@ void P_ProcessInput(int32_t snum)
|
|||
{
|
||||
if (p->dummyplayersprite == -1)
|
||||
p->dummyplayersprite =
|
||||
A_Spawn(pi,PLAYERONWATER);
|
||||
A_Spawn(pi,PLAYERONWATER);
|
||||
sprite[p->dummyplayersprite].pal = sprite[p->i].pal;
|
||||
sprite[p->dummyplayersprite].cstat |= 32768;
|
||||
|
||||
|
@ -5168,6 +5168,22 @@ SHOOTINCODE:
|
|||
X_OnEvent(EVENT_HOLSTER, pi, snum, -1);
|
||||
if (aGameVars[g_iReturnVarID].val.lValue == 0)
|
||||
{
|
||||
if (p->curr_weapon > KNEE_WEAPON)
|
||||
{
|
||||
if (p->holster_weapon == 0 && p->weapon_pos == 0)
|
||||
{
|
||||
p->holster_weapon = 1;
|
||||
p->weapon_pos = -1;
|
||||
P_DoQuote(73,p);
|
||||
}
|
||||
else if (p->holster_weapon == 1 && p->weapon_pos == -9)
|
||||
{
|
||||
p->holster_weapon = 0;
|
||||
p->weapon_pos = 10;
|
||||
P_DoQuote(74,p);
|
||||
}
|
||||
}
|
||||
|
||||
if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_HOLSTER_CLEARS_CLIP)
|
||||
{
|
||||
if (p->ammo_amount[p->curr_weapon] > aplWeaponClip[p->curr_weapon][snum]
|
||||
|
@ -5200,7 +5216,7 @@ SHOOTINCODE:
|
|||
s->x -= x;
|
||||
s->y -= y;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// this is a hack for WEAPON_FIREEVERYOTHER
|
||||
|
|
|
@ -301,8 +301,8 @@ static int32_t G_CacheSound(uint32_t num)
|
|||
if ((ud.level_number == 0 && ud.volume_number == 0 && (num == 189 || num == 232 || num == 99 || num == 233 || num == 17)) ||
|
||||
(l < 12288))
|
||||
{
|
||||
g_sounds[num].lock = 199;
|
||||
allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
|
||||
g_soundlocks[num] = 199;
|
||||
allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_soundlocks[num]);
|
||||
if (g_sounds[num].ptr != NULL)
|
||||
kread(fp, g_sounds[num].ptr , l);
|
||||
}
|
||||
|
@ -1318,13 +1318,14 @@ static void resetpspritevars(char g)
|
|||
int16_t i, j, nexti,circ;
|
||||
// int32_t firstx,firsty;
|
||||
spritetype *s;
|
||||
char aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS];
|
||||
STATUSBARTYPE tsbar[MAXPLAYERS];
|
||||
uint8_t aimmode[MAXPLAYERS],autoaim[MAXPLAYERS],weaponswitch[MAXPLAYERS];
|
||||
DukeStatus_t tsbar[MAXPLAYERS];
|
||||
|
||||
A_InsertSprite(g_player[0].ps->cursectnum,g_player[0].ps->posx,g_player[0].ps->posy,g_player[0].ps->posz,
|
||||
APLAYER,0,0,0,g_player[0].ps->ang,0,0,0,10);
|
||||
|
||||
if (ud.recstat != 2) for (i=0; i<ud.multimode; i++)
|
||||
if (ud.recstat != 2)
|
||||
for (i=0; i<ud.multimode; i++)
|
||||
{
|
||||
aimmode[i] = g_player[i].ps->aim_mode;
|
||||
autoaim[i] = g_player[i].ps->auto_aim;
|
||||
|
|
|
@ -51,7 +51,7 @@ void ReadSaveGameHeaders(void)
|
|||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (kdfread(&dummy,4,1,fil) != 1)
|
||||
if (kdfread(&dummy,sizeof(dummy),1,fil) != 1)
|
||||
{
|
||||
kclose(fil);
|
||||
continue;
|
||||
|
@ -61,7 +61,7 @@ void ReadSaveGameHeaders(void)
|
|||
kclose(fil);
|
||||
continue;
|
||||
}
|
||||
if (kdfread(&dummy,4,1,fil) != 1)
|
||||
if (kdfread(&dummy,sizeof(dummy),1,fil) != 1)
|
||||
{
|
||||
kclose(fil);
|
||||
continue;
|
||||
|
@ -92,7 +92,7 @@ int32_t G_LoadSaveHeader(char spot,struct savehead *saveh)
|
|||
g_szBuf[bv]=0;
|
||||
// AddLog(g_szBuf);
|
||||
|
||||
if (kdfread(&bv,4,1,fil) != 1) goto corrupt;
|
||||
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
|
||||
/* if (bv != BYTEVERSION)
|
||||
{
|
||||
P_DoQuote(114,g_player[myconnectindex].ps);
|
||||
|
@ -170,7 +170,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
g_szBuf[bv]=0;
|
||||
// AddLog(g_szBuf);
|
||||
|
||||
if (kdfread(&bv,4,1,fil) != 1) return -1;
|
||||
if (kdfread(&bv,sizeof(bv),1,fil) != 1) return -1;
|
||||
if (bv != BYTEVERSION)
|
||||
{
|
||||
P_DoQuote(114,g_player[myconnectindex].ps);
|
||||
|
@ -325,6 +325,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
if (scriptptrs[i]&1) T2 += j;
|
||||
if (scriptptrs[i]&2) T5 += j;
|
||||
if (scriptptrs[i]&4) T6 += j;
|
||||
ActorExtra[i].projectile = &SpriteProjectile[i];
|
||||
}
|
||||
|
||||
if (kdfread(&lockclock,sizeof(lockclock),1,fil) != 1) goto corrupt;
|
||||
|
@ -374,6 +375,7 @@ int32_t G_LoadPlayer(int32_t spot)
|
|||
if (kdfread(&g_globalRandom,sizeof(g_globalRandom),1,fil) != 1) goto corrupt;
|
||||
if (kdfread(¶llaxyscale,sizeof(parallaxyscale),1,fil) != 1) goto corrupt;
|
||||
|
||||
if (kdfread(&SpriteProjectile[0],sizeof(projectile_t),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
if (kdfread(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil) != MAXTILES) goto corrupt;
|
||||
|
||||
|
@ -668,7 +670,7 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
dfwrite(&i,sizeof(i),1,fil);
|
||||
dfwrite(g_szBuf,i,1,fil);
|
||||
|
||||
dfwrite(&bv,4,1,fil);
|
||||
dfwrite(&bv,sizeof(bv),1,fil);
|
||||
dfwrite(&ud.multimode,sizeof(ud.multimode),1,fil);
|
||||
|
||||
dfwrite(&ud.savegame[spot][0],19,1,fil);
|
||||
|
@ -715,9 +717,9 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
dfwrite(&headspritesect[0],sizeof(headspritesect[0]),MAXSECTORS+1,fil);
|
||||
dfwrite(&prevspritesect[0],sizeof(prevspritesect[0]),MAXSPRITES,fil);
|
||||
dfwrite(&nextspritesect[0],sizeof(nextspritesect[0]),MAXSPRITES,fil);
|
||||
dfwrite(&headspritestat[STAT_DEFAULT],2,MAXSTATUS+1,fil);
|
||||
dfwrite(&prevspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
|
||||
dfwrite(&nextspritestat[STAT_DEFAULT],2,MAXSPRITES,fil);
|
||||
dfwrite(&headspritestat[STAT_DEFAULT],sizeof(headspritestat[0]),MAXSTATUS+1,fil);
|
||||
dfwrite(&prevspritestat[STAT_DEFAULT],sizeof(prevspritestat[0]),MAXSPRITES,fil);
|
||||
dfwrite(&nextspritestat[STAT_DEFAULT],sizeof(nextspritestat[0]),MAXSPRITES,fil);
|
||||
dfwrite(&g_numCyclers,sizeof(g_numCyclers),1,fil);
|
||||
dfwrite(&cyclers[0][0],sizeof(cyclers[0][0])*6,MAXCYCLERS,fil);
|
||||
for (i=0; i<ud.multimode; i++)
|
||||
|
@ -755,8 +757,8 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
}
|
||||
|
||||
// dfwrite(&scriptptrs[0],sizeof(scriptptrs),g_scriptSize,fil);
|
||||
dfwrite(&bitptr[0],sizeof(uint8_t),(g_scriptSize+7)>>3,fil);
|
||||
dfwrite(&script[0],sizeof(script),g_scriptSize,fil);
|
||||
dfwrite(&bitptr[0],sizeof(bitptr[0]),(g_scriptSize+7)>>3,fil);
|
||||
dfwrite(&script[0],sizeof(script[0]),g_scriptSize,fil);
|
||||
|
||||
for (i=0; i<g_scriptSize; i++)
|
||||
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
|
||||
|
@ -874,6 +876,7 @@ int32_t G_SavePlayer(int32_t spot)
|
|||
dfwrite(&g_globalRandom,sizeof(g_globalRandom),1,fil);
|
||||
dfwrite(¶llaxyscale,sizeof(parallaxyscale),1,fil);
|
||||
|
||||
dfwrite(&SpriteProjectile[0],sizeof(projectile_t),MAXSPRITES,fil);
|
||||
dfwrite(&ProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
|
||||
dfwrite(&DefaultProjectileData[0],sizeof(projectile_t),MAXTILES,fil);
|
||||
|
||||
|
|
|
@ -1015,7 +1015,7 @@ void G_OperateActivators(int32_t low,int32_t snum)
|
|||
if (sprite[i].picnum == ACTIVATORLOCKED)
|
||||
{
|
||||
if (sector[SECT].lotag&16384)
|
||||
sector[SECT].lotag &= 65535-16384;
|
||||
sector[SECT].lotag &= ~16384;
|
||||
else
|
||||
sector[SECT].lotag |= 16384;
|
||||
|
||||
|
@ -1611,7 +1611,7 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith
|
|||
int32_t j, i, darkestwall;
|
||||
walltype *wal = &wall[dawallnum];
|
||||
|
||||
if (wal->overpicnum == MIRROR && wal->pal != 4 && A_CheckSpriteTileFlags(atwith,SPRITE_PROJECTILE) && (ActorExtra[spr].projectile.workslike & PROJECTILE_RPG))
|
||||
if (wal->overpicnum == MIRROR && wal->pal != 4 && A_CheckSpriteTileFlags(atwith,SPRITE_PROJECTILE) && (ActorExtra[spr].projectile->workslike & PROJECTILE_RPG))
|
||||
{
|
||||
if (wal->nextwall == -1 || wall[wal->nextwall].pal != 4)
|
||||
{
|
||||
|
@ -1950,7 +1950,7 @@ void A_DamageObject(int32_t i,int32_t sn)
|
|||
i &= (MAXSPRITES-1);
|
||||
|
||||
if (A_CheckSpriteFlags(sn,SPRITE_PROJECTILE))
|
||||
if (ActorExtra[sn].projectile.workslike & PROJECTILE_RPG)
|
||||
if (ActorExtra[sn].projectile->workslike & PROJECTILE_RPG)
|
||||
rpg = 1;
|
||||
switchpicnum = PN;
|
||||
if ((PN > WATERFOUNTAIN)&&(PN < WATERFOUNTAIN+3))
|
||||
|
@ -2445,7 +2445,7 @@ void allignwarpelevators(void)
|
|||
|
||||
void G_HandleSharedKeys(int32_t snum)
|
||||
{
|
||||
int32_t i, k, dainv;
|
||||
int32_t i, k = 0, dainv;
|
||||
uint32_t sb_snum = g_player[snum].sync->bits, j;
|
||||
DukePlayer_t *p = g_player[snum].ps;
|
||||
|
||||
|
@ -2822,8 +2822,6 @@ CHECKINV1:
|
|||
}
|
||||
}
|
||||
|
||||
k = -1;
|
||||
|
||||
Gv_SetVar(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum],p->i,snum);
|
||||
Gv_SetVar(g_iWeaponVarID,j, p->i, snum);
|
||||
aGameVars[g_iReturnVarID].val.lValue = 0;
|
||||
|
@ -2965,24 +2963,6 @@ CHECKINV1:
|
|||
}
|
||||
|
||||
}
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_HOLSTER))
|
||||
{
|
||||
if (p->curr_weapon > KNEE_WEAPON)
|
||||
{
|
||||
if (p->holster_weapon == 0 && p->weapon_pos == 0)
|
||||
{
|
||||
p->holster_weapon = 1;
|
||||
p->weapon_pos = -1;
|
||||
P_DoQuote(73,p);
|
||||
}
|
||||
else if (p->holster_weapon == 1 && p->weapon_pos == -9)
|
||||
{
|
||||
p->holster_weapon = 0;
|
||||
p->weapon_pos = 10;
|
||||
P_DoQuote(74,p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(sb_snum, SK_HOLODUKE) && p->newowner == -1)
|
||||
|
|
|
@ -292,9 +292,9 @@ int32_t S_LoadSound(uint32_t num)
|
|||
l = kfilelength(fp);
|
||||
g_sounds[num].soundsiz = l;
|
||||
|
||||
g_sounds[num].lock = 200;
|
||||
g_soundlocks[num] = 200;
|
||||
|
||||
allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_sounds[num].lock);
|
||||
allocache((intptr_t *)&g_sounds[num].ptr,l,(char *)&g_soundlocks[num]);
|
||||
kread(fp, g_sounds[num].ptr , l);
|
||||
kclose(fp);
|
||||
return 1;
|
||||
|
@ -410,9 +410,9 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (g_sounds[num].lock < 200)
|
||||
g_sounds[num].lock = 200;
|
||||
else g_sounds[num].lock++;
|
||||
if (g_soundlocks[num] < 200)
|
||||
g_soundlocks[num] = 200;
|
||||
else g_soundlocks[num]++;
|
||||
}
|
||||
|
||||
if (g_sounds[num].m&16) sndist = 0;
|
||||
|
@ -454,7 +454,7 @@ int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos)
|
|||
g_sounds[num].SoundOwner[g_sounds[num].num].voice = voice;
|
||||
g_sounds[num].num++;
|
||||
}
|
||||
else g_sounds[num].lock--;
|
||||
else g_soundlocks[num]--;
|
||||
return (voice);
|
||||
}
|
||||
|
||||
|
@ -493,9 +493,9 @@ void S_PlaySound(int32_t num)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (g_sounds[num].lock < 200)
|
||||
g_sounds[num].lock = 200;
|
||||
else g_sounds[num].lock++;
|
||||
if (g_soundlocks[num] < 200)
|
||||
g_soundlocks[num] = 200;
|
||||
else g_soundlocks[num]++;
|
||||
}
|
||||
|
||||
if (g_sounds[num].m&1)
|
||||
|
@ -530,7 +530,7 @@ void S_PlaySound(int32_t num)
|
|||
}
|
||||
|
||||
if (voice > FX_Ok) return;
|
||||
g_sounds[num].lock--;
|
||||
g_soundlocks[num]--;
|
||||
}
|
||||
|
||||
int32_t A_PlaySound(uint32_t num, int32_t i)
|
||||
|
@ -698,7 +698,7 @@ void S_TestSoundCallback(uint32_t num)
|
|||
g_sounds[num].SoundOwner[tempk-1].i = -1;
|
||||
}
|
||||
|
||||
g_sounds[num].lock--;
|
||||
g_soundlocks[num]--;
|
||||
}
|
||||
|
||||
void S_ClearSoundLocks(void)
|
||||
|
@ -706,8 +706,8 @@ void S_ClearSoundLocks(void)
|
|||
int32_t i;
|
||||
|
||||
for (i=0; i<MAXSOUNDS; i++)
|
||||
if (g_sounds[i].lock >= 200)
|
||||
g_sounds[i].lock = 199;
|
||||
if (g_soundlocks[i] >= 200)
|
||||
g_soundlocks[i] = 199;
|
||||
|
||||
for (i=0; i<11; i++)
|
||||
if (lumplockbyte[i] >= 200)
|
||||
|
@ -725,7 +725,7 @@ int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
|
|||
{
|
||||
if (i == -1)
|
||||
{
|
||||
if (g_sounds[num].lock == 200)
|
||||
if (g_soundlocks[num] == 200)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ static struct
|
|||
int32_t xdim3d, ydim3d, bpp3d;
|
||||
int32_t forcesetup;
|
||||
int32_t usemouse, usejoy;
|
||||
char selectedgrp[BMAX_PATH+1];
|
||||
int32_t game;
|
||||
int32_t crcval;
|
||||
char selectedgrp[BMAX_PATH];
|
||||
} settings;
|
||||
|
||||
extern int32_t gtkenabled;
|
||||
|
|
|
@ -34,10 +34,10 @@ static struct
|
|||
int32_t xdim, ydim, bpp;
|
||||
int32_t forcesetup;
|
||||
int32_t usemouse, usejoy;
|
||||
char selectedgrp[BMAX_PATH+1];
|
||||
int32_t game;
|
||||
int32_t crcval; // for finding the grp in the list again
|
||||
char *gamedir;
|
||||
char selectedgrp[BMAX_PATH];
|
||||
}
|
||||
settings;
|
||||
|
||||
|
@ -51,14 +51,14 @@ static int32_t done = -1, mode = TAB_CONFIG;
|
|||
static CACHE1D_FIND_REC *finddirs=NULL;
|
||||
static int32_t numdirs=0;
|
||||
|
||||
static void clearfilenames(void)
|
||||
static inline void clearfilenames(void)
|
||||
{
|
||||
klistfree(finddirs);
|
||||
finddirs = NULL;
|
||||
numdirs = 0;
|
||||
}
|
||||
|
||||
static int32_t getfilenames(char *path)
|
||||
static inline int32_t getfilenames(char *path)
|
||||
{
|
||||
CACHE1D_FIND_REC *r;
|
||||
|
||||
|
@ -88,12 +88,34 @@ extern int32_t g_noSetup;
|
|||
#define INPUT_JOYSTICK 2
|
||||
#define INPUT_ALL 3
|
||||
|
||||
const char *controlstrings[] = { "Keyboard only", "Keyboard and mouse", "Keyboard and joystick", "All supported devices" };
|
||||
|
||||
static void PopulateForm(int32_t pgs)
|
||||
{
|
||||
HWND hwnd;
|
||||
char buf[256];
|
||||
char buf[512];
|
||||
int32_t i,j;
|
||||
|
||||
if (pgs & POPULATE_GAMEDIRS)
|
||||
{
|
||||
CACHE1D_FIND_REC *dirs = NULL;
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR);
|
||||
|
||||
getfilenames("/");
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
j = ComboBox_AddString(hwnd, "None");
|
||||
(void)ComboBox_SetItemData(hwnd, j, 0);
|
||||
(void)ComboBox_SetCurSel(hwnd, j);
|
||||
for (dirs=finddirs,i=1; dirs != NULL; dirs=dirs->next,i++)
|
||||
{
|
||||
(void)ComboBox_AddString(hwnd, dirs->name);
|
||||
(void)ComboBox_SetItemData(hwnd, i, i);
|
||||
if (Bstrcasecmp(dirs->name,settings.gamedir) == 0)
|
||||
(void)ComboBox_SetCurSel(hwnd, i);
|
||||
}
|
||||
}
|
||||
|
||||
if (pgs & POPULATE_VIDEO)
|
||||
{
|
||||
int32_t mode;
|
||||
|
@ -120,7 +142,9 @@ static void PopulateForm(int32_t pgs)
|
|||
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), ((settings.flags&1) ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), ((settings.flags&2) ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
|
||||
for (i=0; i<validmodecnt; i++)
|
||||
{
|
||||
if (validmode[i].fs != (settings.flags & 1)) continue;
|
||||
|
@ -136,7 +160,7 @@ static void PopulateForm(int32_t pgs)
|
|||
|
||||
if (pgs & POPULATE_CONFIG)
|
||||
{
|
||||
/*
|
||||
#if 0
|
||||
struct audioenumdev *d;
|
||||
char *n;
|
||||
|
||||
|
@ -165,31 +189,34 @@ static void PopulateForm(int32_t pgs)
|
|||
d = d->next;
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED));
|
||||
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCAUTOLOAD), (!(settings.flags & 4) ? BST_CHECKED : BST_UNCHECKED));
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCINPUT);
|
||||
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
(void)ComboBox_SetCurSel(hwnd, 0);
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
static const char *s[] = { "Keyboard only", "Keyboard and mouse", "Keyboard and joystick", "All supported devices" };
|
||||
(void)ComboBox_InsertString(hwnd, i, controlstrings[i]);
|
||||
(void)ComboBox_SetItemData(hwnd, i, i);
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCINPUT);
|
||||
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
j = ComboBox_AddString(hwnd, s[INPUT_KB]);
|
||||
(void)ComboBox_SetItemData(hwnd, j, INPUT_KB);
|
||||
(void)ComboBox_SetCurSel(hwnd, j);
|
||||
for (i=1; i<4; i++)
|
||||
switch (i)
|
||||
{
|
||||
j = ComboBox_AddString(hwnd, s[i]);
|
||||
(void)ComboBox_SetItemData(hwnd, j, i);
|
||||
if ((settings.usemouse && !settings.usejoy && i == INPUT_MOUSE) ||
|
||||
(!settings.usemouse && settings.usejoy && i == INPUT_JOYSTICK) ||
|
||||
(settings.usemouse && settings.usejoy && i == INPUT_ALL))
|
||||
(void)ComboBox_SetCurSel(hwnd, j);
|
||||
case INPUT_MOUSE:
|
||||
if (settings.usemouse && !settings.usejoy)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
break;
|
||||
case INPUT_JOYSTICK:
|
||||
if (!settings.usemouse && settings.usejoy)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
break;
|
||||
case INPUT_ALL:
|
||||
if (settings.usemouse && settings.usejoy)(void)ComboBox_SetCurSel(hwnd, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (pgs & POPULATE_GAME)
|
||||
|
@ -210,29 +237,6 @@ static void PopulateForm(int32_t pgs)
|
|||
if (!Bstrcasecmp(fg->name, settings.selectedgrp))(void)ListBox_SetCurSel(hwnd, j);
|
||||
}
|
||||
}
|
||||
|
||||
if (pgs & POPULATE_GAMEDIRS)
|
||||
{
|
||||
CACHE1D_FIND_REC *dirs = NULL;
|
||||
|
||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCGAMEDIR);
|
||||
|
||||
getfilenames("/");
|
||||
(void)ComboBox_ResetContent(hwnd);
|
||||
j = ComboBox_AddString(hwnd, "None");
|
||||
(void)ComboBox_SetItemData(hwnd, j, 0);
|
||||
(void)ComboBox_SetCurSel(hwnd, j);
|
||||
for (dirs=finddirs,i=1; dirs != NULL; dirs=dirs->next,i++)
|
||||
{
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
if (Bstrcasecmp(TEXCACHEFILE,dirs->name) == 0) continue;
|
||||
#endif
|
||||
j = ComboBox_AddString(hwnd, dirs->name);
|
||||
(void)ComboBox_SetItemData(hwnd, j, i);
|
||||
if (Bstrcasecmp(dirs->name,settings.gamedir) == 0)
|
||||
(void)ComboBox_SetCurSel(hwnd, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
|
@ -275,14 +279,6 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
settings.flags &= ~4;
|
||||
else settings.flags |= 4;
|
||||
return TRUE;
|
||||
/*
|
||||
case IDCINPUTMOUSE:
|
||||
settings.usemouse = IsDlgButtonChecked(hwndDlg, IDCINPUTMOUSE) == BST_CHECKED;
|
||||
return TRUE;
|
||||
case IDCINPUTJOY:
|
||||
settings.usejoy = IsDlgButtonChecked(hwndDlg, IDCINPUTJOY) == BST_CHECKED;
|
||||
return TRUE;
|
||||
*/
|
||||
case IDCINPUT:
|
||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||
{
|
||||
|
@ -381,10 +377,6 @@ static void EnableConfig(int32_t n)
|
|||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCPOLYMER), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n);
|
||||
/*
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), n);
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), n);
|
||||
*/
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUT), n);
|
||||
|
||||
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCDATA), n);
|
||||
|
|
|
@ -13,15 +13,13 @@
|
|||
|
||||
// config page
|
||||
#define IDCFULLSCREEN 100
|
||||
#define IDCVMODE 101
|
||||
#define IDCSOUNDDRV 102
|
||||
#define IDCMIDIDEV 103
|
||||
#define IDCCDADEV 104
|
||||
// #define IDCINPUTMOUSE 105
|
||||
// #define IDCINPUTJOY 106
|
||||
#define IDCALWAYSSHOW 107
|
||||
#define IDCDATA 108
|
||||
#define IDCGAMEDIR 109
|
||||
#define IDCPOLYMER 110
|
||||
#define IDCAUTOLOAD 111
|
||||
#define IDCINPUT 112
|
||||
#define IDCVMODE 101
|
||||
#define IDCSOUNDDRV 102
|
||||
#define IDCMIDIDEV 103
|
||||
#define IDCCDADEV 104
|
||||
#define IDCALWAYSSHOW 105
|
||||
#define IDCDATA 106
|
||||
#define IDCGAMEDIR 107
|
||||
#define IDCPOLYMER 108
|
||||
#define IDCAUTOLOAD 109
|
||||
#define IDCINPUT 110
|
||||
|
|
Loading…
Reference in a new issue