git-svn-id: https://svn.eduke32.com/eduke32@612 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-02-06 21:02:11 +00:00
parent ce81d4f061
commit 517c392a3c
8 changed files with 1531 additions and 1566 deletions

View file

@ -171,18 +171,16 @@ int r_animsmoothing = 1;
static float fogresult, ofogresult, fogcol[4];
static void fogcalc(signed char shade, char vis, char pal)
{
if (vis < 240) fogresult = (float)gvisibility*(vis+16+(shade<0?(-(shade)*(shade))/8.f:((shade)*(shade))/8.f));
else fogresult = (float)gvisibility*((vis-240+(shade<0?(-(shade)*(shade))/8.f:((shade)*(shade))/8.f))/(klabs(vis-256)));
if (fogresult < 0.010) fogresult = 0.010;
else if (fogresult > 10.000) fogresult = 10.000;
fogcol[0] = (float)palookupfog[pal].r / 63.f;
fogcol[1] = (float)palookupfog[pal].g / 63.f;
fogcol[2] = (float)palookupfog[pal].b / 63.f;
fogcol[3] = 0;
// making this a macro should speed things up at the expense of code size
#define fogcalc(shade, vis, pal) \
{ \
fogresult = (float)gvisibility*(vis+16+(shade<0?(-(shade)*(shade))*0.125f:((shade)*(shade))*0.125f)); \
if (vis > 239) fogresult = (float)gvisibility*((vis-240+(shade<0?(-(shade)*(shade))*0.125f:((shade)*(shade))*0.125f))/(klabs(vis-256))); \
fogresult = min(max(fogresult, 0.01f),10.f); \
fogcol[0] = (float)palookupfog[pal].r / 63.f; \
fogcol[1] = (float)palookupfog[pal].g / 63.f; \
fogcol[2] = (float)palookupfog[pal].b / 63.f; \
fogcol[3] = 0; \
}
#endif
@ -1779,10 +1777,10 @@ 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));
if (usehightile)
for (pal1=SPECPAL;pal1<=REDPAL;pal1++)
if (hicfindsubst(globalpicnum, pal1, 0))
gltexcache(globalpicnum, pal1, method&(~3));
if (skyclamphack) method |= 4;
pth = gltexcache(globalpicnum,globalpal,method&(~3));

View file

@ -27,19 +27,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern int numenvsnds;
extern int actor_tog;
void updateinterpolations() //Stick at beginning of domovethings
inline void updateinterpolations(void) //Stick at beginning of domovethings
{
int i=numinterpolations-1;
for (;i>=0;i--) oldipos[i] = *curipos[i];
}
void setinterpolation(int *posptr)
{
int i;
int i=numinterpolations-1;
if (numinterpolations >= MAXINTERPOLATIONS) return;
for (i=numinterpolations-1;i>=0;i--)
for (;i>=0;i--)
if (curipos[i] == posptr) return;
curipos[numinterpolations] = posptr;
oldipos[numinterpolations] = *posptr;
@ -48,9 +47,9 @@ void setinterpolation(int *posptr)
void stopinterpolation(int *posptr)
{
int i;
int i=numinterpolations-1;
for (i=numinterpolations-1;i>=startofdynamicinterpolations;i--)
for (;i>=startofdynamicinterpolations;i--)
if (curipos[i] == posptr)
{
numinterpolations--;
@ -74,27 +73,20 @@ void dointerpolations(int smoothratio) //Stick at beginning of drawscreen
}
}
void restoreinterpolations() //Stick at end of drawscreen
inline void restoreinterpolations(void) //Stick at end of drawscreen
{
int i=numinterpolations-1;
for (;i>=0;i--) *curipos[i] = bakipos[i];
}
int ceilingspace(int sectnum)
inline int ceilingspace(int sectnum)
{
if ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1))
return 1;
return 0;
return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && (sector[sectnum].ceilingpicnum==MOONSKY1 || sector[sectnum].ceilingpicnum==BIGORBIT1)?1:0);
}
int floorspace(int sectnum)
inline int floorspace(int sectnum)
{
if ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0)
{
if ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1)) return 1;
}
return 0;
return ((sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 && ((sector[sectnum].floorpicnum==MOONSKY1)||(sector[sectnum].floorpicnum==BIGORBIT1))?1:0);
}
void addammo(int weapon,player_struct *p,int amount)
@ -541,15 +533,12 @@ int movesprite(int spritenum, int xchange, int ychange, int zchange, unsigned in
return(retval);
}
int ssp(int i,unsigned int cliptype) //The set sprite function
inline int ssp(int i,unsigned int cliptype) //The set sprite function
{
spritetype *s= &sprite[i];
int movetype = movesprite(i,
(s->xvel*(sintable[(s->ang+512)&2047]))>>14,
(s->xvel*(sintable[s->ang&2047]))>>14,s->zvel,
cliptype);
return (movetype==0);
return (movesprite(i,
(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14,
(sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,sprite[i].zvel,
cliptype)==0);
}
#undef deletesprite
@ -570,49 +559,26 @@ void deletespriteEVENT(int s)
void insertspriteq(int i)
{
if (spriteqamount > 0)
if (spriteqamount == 0)
{
if (spriteq[spriteqloc] >= 0)
sprite[spriteq[spriteqloc]].xrepeat = 0;
spriteq[spriteqloc] = i;
spriteqloc = (spriteqloc+1)%spriteqamount;
deletesprite(i);
return;
}
// else sprite[i].xrepeat = sprite[i].yrepeat = 0;
else deletesprite(i);
if (spriteq[spriteqloc] >= 0)
sprite[spriteq[spriteqloc]].xrepeat = 0;
spriteq[spriteqloc] = i;
spriteqloc = (spriteqloc+1)%spriteqamount;
}
void lotsofmoney(int sp, int n)
void lotsofmoneymailpaper(int sp, int n, int pic)
{
int i=n ,j;
spritetype *s = &sprite[sp];
for (;i>0;i--)
{
j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MONEY,-32,8,8,TRAND&2047,0,0,sp,5);
sprite[j].cstat = TRAND&12;
}
}
void lotsofmail(int sp, int n)
{
int i=n ,j;
spritetype *s = &sprite[sp];
for (;i>0;i--)
{
j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),MAIL,-32,8,8,TRAND&2047,0,0,sp,5);
sprite[j].cstat = TRAND&12;
}
}
void lotsofpaper(int sp, int n)
{
int i=n ,j;
spritetype *s = &sprite[sp];
for (;i>0;i--)
{
j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),PAPER,-32,8,8,TRAND&2047,0,0,sp,5);
j = EGS(s->sectnum,s->x,s->y,s->z-(TRAND%(47<<8)),pic,-32,8,8,TRAND&2047,0,0,sp,5);
sprite[j].cstat = TRAND&12;
}
}

View file

@ -161,13 +161,13 @@ extern void CONFIG_ReadKeys(void);
extern void readsavenames(void);
extern int32 CONFIG_ReadSetup(void);
extern void CONFIG_WriteSetup(void);
extern void updateinterpolations(void);
extern inline void updateinterpolations(void);
extern void setinterpolation(int *posptr);
extern void stopinterpolation(int *posptr);
extern void dointerpolations(int smoothratio);
extern void restoreinterpolations(void);
extern int ceilingspace(int sectnum);
extern int floorspace(int sectnum);
extern inline void restoreinterpolations(void);
extern inline int ceilingspace(int sectnum);
extern inline int floorspace(int sectnum);
extern void addammo(int weapon,player_struct *p,int amount);
extern void addweaponnoswitch(player_struct *p,int weapon);
extern void addweapon(player_struct *p,int weapon);
@ -175,11 +175,9 @@ extern void checkavailinven(player_struct *p);
extern void checkavailweapon(player_struct *p);
extern void hitradius(int i,int r,int hp1,int hp2,int hp3,int hp4);
extern int movesprite(int spritenum,int xchange,int ychange,int zchange,unsigned int cliptype);
extern int ssp(int i,unsigned int cliptype);
extern inline int ssp(int i,unsigned int cliptype);
extern void insertspriteq(int i);
extern void lotsofmoney(int sp,int n);
extern void lotsofmail(int sp, int n);
extern void lotsofpaper(int sp, int n);
extern void lotsofmoneymailpaper(int sp,int n,int pic);
extern void guts(int sp,int gtype,int n,int p);
extern void setsectinterpolate(int i);
extern void clearsectinterpolate(int i);

View file

@ -3675,7 +3675,7 @@ static void view(player_struct *pp, int *vx, int *vy,int *vz,short *vsectnum, in
//REPLACE FULLY
void drawbackground(void)
{
short dapicnum;
int dapicnum;
int x,y,x1,y1,x2,y2,rx;
flushperms();

View file

@ -4015,12 +4015,12 @@ static int parse(void)
case CON_MONEY:
insptr++;
lotsofmoney(g_i,*insptr++);
lotsofmoneymailpaper(g_i,*insptr++,MONEY);
break;
case CON_MAIL:
insptr++;
lotsofmail(g_i,*insptr++);
lotsofmoneymailpaper(g_i,*insptr++,MAIL);
break;
case CON_SLEEPTIME:
@ -4030,7 +4030,7 @@ static int parse(void)
case CON_PAPER:
insptr++;
lotsofpaper(g_i,*insptr++);
lotsofmoneymailpaper(g_i,*insptr++,PAPER);
break;
case CON_ADDKILLS:

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1788,7 +1788,7 @@ void checkhitwall(int spr,int dawallnum,int x,int y,int z,int atwith)
case ATM__STATIC:
wal->picnum = ATMBROKE;
lotsofmoney(spr,1+(TRAND&7));
lotsofmoneymailpaper(spr,1+(TRAND&7),MONEY);
spritesound(GLASS_HEAVYBREAK,spr);
break;
@ -2173,7 +2173,7 @@ void checkhitsprite(int i,int sn)
case STATUEFLASH__STATIC:
case STATUE__STATIC:
if (PN == BOTTLE10)
lotsofmoney(i,4+(TRAND&3));
lotsofmoneymailpaper(i,4+(TRAND&3),MONEY);
else if (PN == STATUE || PN == STATUEFLASH)
{
lotsofcolourglass(i,-1,40);
@ -3241,7 +3241,7 @@ void checksectors(int snum)
}
if (ud.cashman && g_player[snum].sync->bits&(1<<29))
lotsofmoney(p->i,2);
lotsofmoneymailpaper(p->i,2,MONEY);
if (p->newowner >= 0)
{