mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Patch from hunter_rus
git-svn-id: https://svn.eduke32.com/eduke32@606 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
71cd8fd6c3
commit
cd085abf8d
8 changed files with 82 additions and 27 deletions
|
@ -158,7 +158,6 @@ typedef struct BPACK
|
|||
|
||||
typedef struct BPACK {
|
||||
unsigned int mdanimtims;
|
||||
int oldmdtims;
|
||||
short mdanimcur;
|
||||
short angoff;
|
||||
short pitch, roll;
|
||||
|
@ -523,6 +522,7 @@ extern int r_vertexarrays;
|
|||
extern int r_vbos;
|
||||
extern int r_vbocount;
|
||||
extern int r_animsmoothing;
|
||||
extern int mdtims, omdtims;
|
||||
#endif
|
||||
|
||||
void hicinit(void);
|
||||
|
|
|
@ -194,6 +194,7 @@ int gettile(int tilenum);
|
|||
int menuselect(void);
|
||||
int getfilenames(char *path, char *kind);
|
||||
void clearfilenames(void);
|
||||
void loadmhk();
|
||||
|
||||
void clearkeys(void) { memset(keystatus,0,sizeof(keystatus)); }
|
||||
|
||||
|
@ -355,6 +356,7 @@ int app_main(int argc, const char **argv)
|
|||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
if (i < 0)
|
||||
{
|
||||
|
@ -511,6 +513,25 @@ void showmouse(void)
|
|||
}
|
||||
}
|
||||
|
||||
int mhk=0;
|
||||
void loadmhk()
|
||||
{
|
||||
char *p;char levname[BMAX_PATH];
|
||||
|
||||
if(!mhk)return;
|
||||
strcpy(levname, boardfilename);
|
||||
p = Bstrrchr(levname,'.');
|
||||
if (!p) strcat(levname,".mhk");
|
||||
else
|
||||
{
|
||||
p[1]='m';
|
||||
p[2]='h';
|
||||
p[3]='k';
|
||||
p[4]=0;
|
||||
}
|
||||
if (!loadmaphack(levname))initprintf("Loaded map hack file '%s'\n",levname);else mhk=2;
|
||||
}
|
||||
|
||||
void editinput(void)
|
||||
{
|
||||
char smooshyalign, repeatpanalign, *ptr, buffer[80];
|
||||
|
@ -583,8 +604,26 @@ void editinput(void)
|
|||
if (keystatus[0x3c] > 0) posx++;
|
||||
if (keystatus[0x3d] > 0) posy--;
|
||||
if (keystatus[0x3e] > 0) posy++;
|
||||
if (keystatus[0x43] > 0) ang--;
|
||||
if (keystatus[0x44] > 0) ang++;
|
||||
// if (keystatus[0x43] > 0) ang--;
|
||||
// if (keystatus[0x44] > 0) ang++;
|
||||
|
||||
if (keystatus[0x43] > 0)
|
||||
{
|
||||
mhk=1;
|
||||
loadmhk();
|
||||
keystatus[0x43] = 0;
|
||||
}
|
||||
if (keystatus[0x44] > 0)
|
||||
{
|
||||
memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES);
|
||||
memset(spritesmooth, 0, sizeof(spritesmooth));
|
||||
mhk=0;
|
||||
initprintf("Maphacks dissabled\n");
|
||||
keystatus[0x44] = 0;
|
||||
}
|
||||
begindrawing(); //{{{
|
||||
if(mhk)printext256(0,16,whitecol,0,(mhk==1)?"Maphacks ON":"Maphacks ON (not found)",0);
|
||||
enddrawing(); //}}}
|
||||
|
||||
if (angvel != 0) //ang += angvel * constant
|
||||
{
|
||||
|
@ -5678,6 +5717,7 @@ CANCEL:
|
|||
|
||||
ExtPreLoadMap();
|
||||
i = loadboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
loadmhk();
|
||||
if (i == -2) i = loadoldboard(boardfilename,(!pathsearchmode&&grponlymode?2:0),&posx,&posy,&posz,&ang,&cursectnum);
|
||||
if (i < 0)
|
||||
{
|
||||
|
|
|
@ -7777,7 +7777,12 @@ void nextpage(void)
|
|||
|
||||
#ifdef USE_OPENGL
|
||||
omdtims = mdtims; mdtims = getticks();
|
||||
if (((unsigned int)(mdtims-omdtims)) > 10000) omdtims = mdtims;
|
||||
|
||||
if(mdpause)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<MAXSPRITES;i++)if(spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims-omdtims;
|
||||
}
|
||||
#endif
|
||||
|
||||
beforedrawrooms = 1;
|
||||
|
|
|
@ -951,15 +951,6 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
|||
}
|
||||
else kclose(filh);
|
||||
m->usesalpha = hasalpha;
|
||||
|
||||
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)texidx);
|
||||
bglBindTexture(GL_TEXTURE_2D,*texidx);
|
||||
|
||||
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr);
|
||||
if (glinfo.texcompr && glusetexcompr) intexfmt = hasalpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
|
||||
else if (!hasalpha) intexfmt = GL_RGB;
|
||||
if (glinfo.bgra) texfmt = GL_BGRA;
|
||||
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0);
|
||||
if (pal>=SPECPAL&&pal<=REDPAL)
|
||||
{
|
||||
//_initprintf("%cLoaded palmap %d(%dx%d)",sk->palmap?'+':'-',pal,xsiz,ysiz);
|
||||
|
@ -972,6 +963,15 @@ static int mdloadskin(md2model *m, int number, int pal, int surf)
|
|||
cachefil=0;
|
||||
//_initprintf("#%d\n",sk->palmap);
|
||||
}
|
||||
|
||||
if ((doalloc&3)==1) bglGenTextures(1,(GLuint*)texidx);
|
||||
bglBindTexture(GL_TEXTURE_2D,*texidx);
|
||||
|
||||
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr);
|
||||
if (glinfo.texcompr && glusetexcompr) intexfmt = hasalpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
|
||||
else if (!hasalpha) intexfmt = GL_RGB;
|
||||
if (glinfo.bgra) texfmt = GL_BGRA;
|
||||
uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0);
|
||||
free((void*)fptr);
|
||||
}
|
||||
|
||||
|
@ -1046,11 +1046,6 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
|||
int fps;
|
||||
|
||||
m->cframe = m->nframe = tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].framenum;
|
||||
if (!mdpause&&spriteext[tspr->owner].oldmdtims!=mdtims)
|
||||
{
|
||||
spriteext[tspr->owner].mdanimtims+=max(0,mdtims-omdtims);
|
||||
spriteext[tspr->owner].oldmdtims=mdtims;
|
||||
}
|
||||
|
||||
for (anim = m->animations;
|
||||
anim && anim->startframe != m->cframe;
|
||||
|
@ -1061,14 +1056,14 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
|||
{
|
||||
if (spritesmooth[tspr->owner].mdsmooth == 0)
|
||||
{
|
||||
spriteext[tspr->owner].mdanimtims = 0;
|
||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
spritesmooth[tspr->owner].mdsmooth = 1;
|
||||
spritesmooth[tspr->owner].mdcurframe = m->cframe;
|
||||
}
|
||||
if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
|
||||
{
|
||||
spriteext[tspr->owner].mdanimtims = 0;
|
||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
spritesmooth[tspr->owner].mdsmooth = 1;
|
||||
spritesmooth[tspr->owner].mdoldframe = spritesmooth[tspr->owner].mdcurframe;
|
||||
|
@ -1077,7 +1072,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
|||
}
|
||||
else if (r_animsmoothing && (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration != 0) && (spritesmooth[tspr->owner].mdcurframe != m->cframe))
|
||||
{
|
||||
spriteext[tspr->owner].mdanimtims = 0;
|
||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
spritesmooth[tspr->owner].mdsmooth = 1;
|
||||
spritesmooth[tspr->owner].mdoldframe = spritesmooth[tspr->owner].mdcurframe;
|
||||
|
@ -1095,7 +1090,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
|||
//if (spriteext[tspr->owner].flags & SPREXT_NOMDANIM) OSD_Printf("SPREXT_NOMDANIM\n");
|
||||
//OSD_Printf("smooth launched ! oldanim %i new anim %i\n", spriteext[tspr->owner].mdanimcur, anim->startframe);
|
||||
spriteext[tspr->owner].mdanimcur = (short)anim->startframe;
|
||||
spriteext[tspr->owner].mdanimtims = 0;
|
||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
if (!r_animsmoothing || (tile2model[Ptile2tile(tspr->picnum,sprite[tspr->owner].pal)].smoothduration == 0))
|
||||
{
|
||||
|
@ -1113,14 +1108,14 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
|||
else
|
||||
fps = anim->fpssc;
|
||||
|
||||
i = (spriteext[tspr->owner].mdanimtims)*((fps*timerticspersec)/120);
|
||||
i = (mdtims-spriteext[tspr->owner].mdanimtims)*((fps*timerticspersec)/120);
|
||||
|
||||
if (spritesmooth[tspr->owner].mdsmooth)
|
||||
j = 65536;
|
||||
else
|
||||
j = ((anim->endframe+1-anim->startframe)<<16);
|
||||
//Just in case you play the game for a VERY int time...
|
||||
if (i < 0) { i = 0; spriteext[tspr->owner].mdanimtims = 0; }
|
||||
if (i < 0) { i = 0;spriteext[tspr->owner].mdanimtims = mdtims; }
|
||||
//compare with j*2 instead of j to ensure i stays > j-65536 for MDANIM_ONESHOT
|
||||
if ((anim) && (i >= j+j) && (fps) && !mdpause) //Keep mdanimtims close to mdtims to avoid the use of MOD
|
||||
spriteext[tspr->owner].mdanimtims += j/((fps*timerticspersec)/120);
|
||||
|
@ -1138,7 +1133,7 @@ static void updateanimation(md2model *m, spritetype *tspr)
|
|||
//OSD_Printf("smoothing... cframe %i nframe %i\n", m->cframe, m->nframe);
|
||||
if (k > 65535)
|
||||
{
|
||||
spriteext[tspr->owner].mdanimtims = 0;
|
||||
spriteext[tspr->owner].mdanimtims = mdtims;
|
||||
m->interpol = 0;
|
||||
spritesmooth[tspr->owner].mdsmooth = 0;
|
||||
m->cframe = m->nframe = (anim) ? anim->startframe : spritesmooth[tspr->owner].mdcurframe;
|
||||
|
|
|
@ -333,7 +333,7 @@ int dedxtfilter(int fil, texcachepicture *pict, char *pic, void *midbuf, char *p
|
|||
static inline void phex(unsigned char v, char *s);
|
||||
void writexcache(char *fn, int len, int dameth, char effect, texcacheheader *head);
|
||||
|
||||
static int mdtims, omdtims;
|
||||
int mdtims, omdtims;
|
||||
float alphahackarray[MAXTILES];
|
||||
#include "mdsprite.c"
|
||||
|
||||
|
@ -1779,6 +1779,7 @@ void drawpoly(double *dpx, double *dpy, int n, int method)
|
|||
float hackscx, hackscy;
|
||||
|
||||
int pal1;
|
||||
if(usehightile)
|
||||
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
|
||||
if (hicfindsubst(globalpicnum, pal1, 0))
|
||||
gltexcache(globalpicnum, pal1, method&(~3));
|
||||
|
|
|
@ -869,6 +869,7 @@ void CONFIG_WriteSetup(void)
|
|||
Bsprintf(buf,"MouseButtonClicked%d",dummy);
|
||||
SCRIPT_PutString(ud.config.scripthandle,"Controls", buf, CONFIG_FunctionNumToName(ud.config.MouseFunctions[dummy][1]));
|
||||
}
|
||||
|
||||
for (dummy=0;dummy<MAXMOUSEAXES;dummy++)
|
||||
{
|
||||
Bsprintf(buf,"MouseAnalogAxes%d",dummy);
|
||||
|
|
|
@ -7006,7 +7006,7 @@ PALONLY:
|
|||
tsprite[spritesortcnt].z = daz;
|
||||
xrep = tsprite[spritesortcnt].xrepeat;// - (klabs(daz-t->z)>>11);
|
||||
tsprite[spritesortcnt].xrepeat = xrep;
|
||||
// tsprite[spritesortcnt].pal = 4; (shadow will have the same model as its actor)
|
||||
tsprite[spritesortcnt].pal = 4;
|
||||
|
||||
yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11);
|
||||
tsprite[spritesortcnt].yrepeat = yrep;
|
||||
|
|
|
@ -234,6 +234,9 @@ int loadplayer(int spot)
|
|||
if (kdfread(§or[0],sizeof(sectortype),MAXSECTORS,fil) != MAXSECTORS) goto corrupt;
|
||||
if (kdfread(&sprite[0],sizeof(spritetype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&spriteext[0],sizeof(spriteexttype),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
for(i=0;i<MAXSPRITES;i++)if(spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
|
||||
#endif
|
||||
if (kdfread(&headspritesect[0],2,MAXSECTORS+1,fil) != MAXSECTORS+1) goto corrupt;
|
||||
if (kdfread(&prevspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
if (kdfread(&nextspritesect[0],2,MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
|
||||
|
@ -584,7 +587,17 @@ int saveplayer(int spot)
|
|||
dfwrite(&numsectors,2,1,fil);
|
||||
dfwrite(§or[0],sizeof(sectortype),MAXSECTORS,fil);
|
||||
dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil);
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
for(i=0;i<MAXSPRITES;i++)if(spriteext[i].mdanimtims)
|
||||
{
|
||||
spriteext[i].mdanimtims=spriteext[i].mdanimtims-mdtims;
|
||||
if(!spriteext[i].mdanimtims)spriteext[i].mdanimtims++;
|
||||
}
|
||||
#endif
|
||||
dfwrite(&spriteext[0],sizeof(spriteexttype),MAXSPRITES,fil);
|
||||
#if defined(POLYMOST) && defined(USE_OPENGL)
|
||||
for(i=0;i<MAXSPRITES;i++)if(spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
|
||||
#endif
|
||||
dfwrite(&headspritesect[0],2,MAXSECTORS+1,fil);
|
||||
dfwrite(&prevspritesect[0],2,MAXSPRITES,fil);
|
||||
dfwrite(&nextspritesect[0],2,MAXSPRITES,fil);
|
||||
|
|
Loading…
Reference in a new issue