Couple weeks worth of random bs changes

git-svn-id: https://svn.eduke32.com/eduke32@1490 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-08-28 23:08:00 +00:00
parent fe7f09105c
commit a9c8d071a6
19 changed files with 362 additions and 516 deletions

View file

@ -122,7 +122,7 @@ EDITOROBJS=$(OBJ)\astub.$o \
$(CC) /c $(CFLAGS) /Fo$@ $< $(CC) /c $(CFLAGS) /Fo$@ $<
{$(SRC)\misc}.rc{$(OBJ)\}.res: {$(SRC)\misc}.rc{$(OBJ)\}.res:
$(RC) /i$(EINC)\ /i$(SRC)\ /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" /fo$@ /r $< $(RC) /i$(EINC)\ /i$(SRC)\ /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" /DPOLYMER /fo$@ /r $<
# TARGETS # TARGETS

View file

@ -36,7 +36,6 @@
#endif #endif
#define REPLACE_SYSTEM_ALLOCATOR #define REPLACE_SYSTEM_ALLOCATOR
#define THREADCACHEMAX 65536
#include "nedmalloc.h" #include "nedmalloc.h"
#ifndef TRUE #ifndef TRUE

View file

@ -29,6 +29,9 @@ DEALINGS IN THE SOFTWARE.
#ifndef NEDMALLOC_H #ifndef NEDMALLOC_H
#define NEDMALLOC_H #define NEDMALLOC_H
#define THREADCACHEMAX 65536
#define THREADCACHEMAXFREESPACE (1024*1024*4)
/* See malloc.c.h for what each function does. /* See malloc.c.h for what each function does.
REPLACE_SYSTEM_ALLOCATOR causes nedalloc's functions to be called malloc, REPLACE_SYSTEM_ALLOCATOR causes nedalloc's functions to be called malloc,

View file

@ -289,7 +289,7 @@ typedef struct s_pranimatespritesinfo {
} _pranimatespritesinfo; } _pranimatespritesinfo;
// MEMORY POOL // MEMORY POOL
#define POLYMER_POOL_SIZE 65572864 #define POLYMER_POOL_SIZE 33554432
extern nedpool* polymer_pool; extern nedpool* polymer_pool;
// EXTERNAL FUNCTIONS // EXTERNAL FUNCTIONS

View file

@ -9,8 +9,6 @@
#define CULL_DELAY 2 #define CULL_DELAY 2
#define MAXCULLCHECKS 1024 #define MAXCULLCHECKS 1024
#define FOGSCALE 0.0000640
extern int32_t lastcullcheck; extern int32_t lastcullcheck;
extern char cullmodel[MAXSPRITES]; extern char cullmodel[MAXSPRITES];
extern int32_t cullcheckcnt; extern int32_t cullcheckcnt;
@ -125,17 +123,18 @@ extern double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdo
extern double gcosang, gsinang, gcosang2, gsinang2; extern double gcosang, gsinang, gcosang2, gsinang2;
extern double gchang, gshang, gctang, gstang, gvisibility; extern double gchang, gshang, gctang, gstang, gvisibility;
#define FOGSCALE 0.0000768
extern float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS]; extern float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS];
static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal) static inline void fogcalc(const int32_t shade, const int32_t vis, const int32_t pal)
{ {
float f = ((shade*shade)*0.125f); float f = shade * 1.75f;
if (shade < 0) f = -f;
if (vis > 239) f = (float)(gvisibility*((vis-240+f)/(klabs(vis-256)))); if (vis > 239) f = (float)(gvisibility*((vis-240+f)/(klabs(vis-256))));
else f = (float)(gvisibility*(vis+16+f)); else f = (float)(gvisibility*(vis+16+f));
fogresult = clamp(f, 0.01f, 10.f); fogresult = clamp(f, 0.01f, 100.f);
Bmemcpy(fogcol, &fogtable[pal<<2], sizeof(fogcol)); Bmemcpy(fogcol, &fogtable[pal<<2], sizeof(fogcol));
} }

View file

@ -1818,8 +1818,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength,
coltype = 3; bitdepth = 8; //For PNGOUT coltype = 3; bitdepth = 8; //For PNGOUT
if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || (kfilebuf[2] != 'F')) return(-1);
(kfilebuf[2] != 'F') || (kfilebuf[12])) return(-1);
paleng = (1<<((kfilebuf[10]&7)+1)); paleng = (1<<((kfilebuf[10]&7)+1));
ptr = (uint8_t *)&kfilebuf[13]; ptr = (uint8_t *)&kfilebuf[13];
if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; } if (kfilebuf[10]&128) { cptr = ptr; ptr += paleng*3; }
@ -2443,7 +2442,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
cptr = &cptr[SSWAPIL(*(uint16_t *)&cptr[2])+2]; cptr = &cptr[SSWAPIL(*(uint16_t *)&cptr[2])+2];
} }
} }
else if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F') && (ubuf[12] == 0)) //.GIF else if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F')) //.GIF
{ {
(*xsiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[6]); (*xsiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[6]);
(*ysiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[8]); (*ysiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[8]);

View file

@ -1,3 +1,4 @@
#include "inttypes.h"
#include "kplib.h" #include "kplib.h"
#include "compat.h" #include "compat.h"

View file

@ -817,7 +817,7 @@ int32_t initinput(void)
if (Bstrcmp(layoutname, "00000409")) if (Bstrcmp(layoutname, "00000409"))
{ {
initprintf("Switching kb layout from %s ",layoutname); initprintf("Switching kb layout from %s ",layoutname);
i = LoadKeyboardLayout("00000409", KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK); LoadKeyboardLayout("00000409", KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK);
GetKeyboardLayoutName(layoutname); GetKeyboardLayoutName(layoutname);
initprintf("to %s\n",layoutname); initprintf("to %s\n",layoutname);
} }

View file

@ -286,104 +286,116 @@ BOLT:
int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
{ {
int32_t oldx, oldy; spritetype *spr = &sprite[spritenum];
int32_t retval; int32_t retval, daz;
int16_t dasectnum, cd; int16_t dasectnum, cd;
int32_t bg = A_CheckEnemySprite(&sprite[spritenum]); int32_t bg = A_CheckEnemySprite(spr);
int32_t daz; int32_t oldx = spr->x, oldy = spr->y;
/*int32_t osectnum = spr->sectnum;*/
if (sprite[spritenum].statnum == STAT_MISC || (bg && sprite[spritenum].xrepeat < 4))
if (spr->statnum == STAT_MISC || (bg && spr->xrepeat < 4))
{ {
sprite[spritenum].x += (change->x*TICSPERFRAME)>>2; spr->x += (change->x*TICSPERFRAME)>>2;
sprite[spritenum].y += (change->y*TICSPERFRAME)>>2; spr->y += (change->y*TICSPERFRAME)>>2;
sprite[spritenum].z += (change->z*TICSPERFRAME)>>2; spr->z += (change->z*TICSPERFRAME)>>2;
if (bg) if (bg)
setsprite(spritenum,(vec3_t *)&sprite[spritenum]); setsprite(spritenum,(vec3_t *)spr);
return 0; return 0;
} }
dasectnum = sprite[spritenum].sectnum; dasectnum = spr->sectnum;
daz = sprite[spritenum].z - ((tilesizy[sprite[spritenum].picnum]*sprite[spritenum].yrepeat)<<1); daz = spr->z - ((tilesizy[spr->picnum]*spr->yrepeat)<<1);
if (bg) if (bg)
{ {
oldx = sprite[spritenum].x; if (spr->xrepeat > 60)
oldy = sprite[spritenum].y;
if (sprite[spritenum].xrepeat > 60)
{ {
int32_t oz = sprite[spritenum].z; int32_t oz = spr->z;
sprite[spritenum].z = daz; spr->z = daz;
retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype);
daz = sprite[spritenum].z; daz = spr->z;
sprite[spritenum].z = oz; spr->z = oz;
} }
else else
{ {
int32_t oz = sprite[spritenum].z; int32_t oz = spr->z;
if (sprite[spritenum].picnum == LIZMAN) if (spr->picnum == LIZMAN)
cd = 292L; cd = 292L;
else if ((ActorType[sprite[spritenum].picnum]&3)) else if ((ActorType[spr->picnum]&3))
cd = sprite[spritenum].clipdist<<2; cd = spr->clipdist<<2;
else else
cd = 192L; cd = 192L;
sprite[spritenum].z = daz; spr->z = daz;
retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype);
daz = sprite[spritenum].z; daz = spr->z;
sprite[spritenum].z = oz; spr->z = oz;
} }
if (dasectnum < 0 || (dasectnum >= 0 && if (dasectnum < 0 || (dasectnum >= 0 &&
((ActorExtra[spritenum].actorstayput >= 0 && ActorExtra[spritenum].actorstayput != dasectnum) || ((ActorExtra[spritenum].actorstayput >= 0 && ActorExtra[spritenum].actorstayput != dasectnum) ||
((sprite[spritenum].picnum == BOSS2) && sprite[spritenum].pal == 0 && sector[dasectnum].lotag != 3) || ((spr->picnum == BOSS2) && spr->pal == 0 && sector[dasectnum].lotag != 3) ||
((sprite[spritenum].picnum == BOSS1 || sprite[spritenum].picnum == BOSS2) && sector[dasectnum].lotag == 1) /*|| ((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == 1) /*||
(sector[dasectnum].lotag == 1 && (sprite[spritenum].picnum == LIZMAN || (sprite[spritenum].picnum == LIZTROOP && sprite[spritenum].zvel == 0)))*/ (sector[dasectnum].lotag == 1 && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))*/
)) ))
) )
{ {
sprite[spritenum].x = oldx; spr->x = oldx;
sprite[spritenum].y = oldy; spr->y = oldy;
/* /*
if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN) if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && spr->picnum == LIZMAN)
sprite[spritenum].ang = (krand()&2047); spr->ang = (krand()&2047);
else if ((ActorExtra[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER) else if ((ActorExtra[spritenum].temp_data[0]&3) == 1 && spr->picnum != COMMANDER)
sprite[spritenum].ang = (krand()&2047); spr->ang = (krand()&2047);
*/ */
setsprite(spritenum,(vec3_t *)&sprite[spritenum]); setsprite(spritenum,(vec3_t *)spr);
if (dasectnum < 0) dasectnum = 0; if (dasectnum < 0) dasectnum = 0;
return (16384+dasectnum); return (16384+dasectnum);
} }
if ((retval&49152) >= 32768 && (ActorExtra[spritenum].cgg==0)) sprite[spritenum].ang += 768; if ((retval&49152) >= 32768 && (ActorExtra[spritenum].cgg==0)) spr->ang += 768;
} }
else else
{ {
int32_t oz = sprite[spritenum].z; int32_t oz = spr->z;
sprite[spritenum].z = daz; spr->z = daz;
if (sprite[spritenum].statnum == STAT_PROJECTILE && (SpriteProjectile[spritenum].workslike & PROJECTILE_REALCLIPDIST) == 0) if (spr->statnum == STAT_PROJECTILE && (SpriteProjectile[spritenum].workslike & PROJECTILE_REALCLIPDIST) == 0)
retval = retval =
clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype);
else else
retval = retval =
clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype); clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(spr->clipdist<<2),(4<<8),(4<<8),cliptype);
daz = sprite[spritenum].z; daz = spr->z;
sprite[spritenum].z = oz; spr->z = oz;
} }
if (dasectnum >= 0) if (dasectnum == -1)
if ((dasectnum != sprite[spritenum].sectnum)) {
dasectnum = spr->sectnum;
/*OSD_Printf("%s:%d wtf\n",__FILE__,__LINE__);*/
}
if ((dasectnum != spr->sectnum))
{
changespritesect(spritenum,dasectnum); changespritesect(spritenum,dasectnum);
daz = sprite[spritenum].z + ((change->z*TICSPERFRAME)>>3); A_GetZLimits(spritenum);
if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)) }
sprite[spritenum].z = daz;
daz = spr->z + ((change->z*TICSPERFRAME)>>3);
bg = (tilesizy[spr->picnum]*spr->yrepeat)>>1;
if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)/*
&&
(osectnum == dasectnum || cansee(oldx, oldy, spr->z - bg, osectnum, spr->x, spr->y, daz - bg, dasectnum))*/
)
spr->z = daz;
else if (retval == 0) retval = 16384+dasectnum; else if (retval == 0) retval = 16384+dasectnum;
if (retval == (16384+dasectnum)) if (retval == (16384+dasectnum))
if (sprite[spritenum].statnum == STAT_PROJECTILE) if (spr->statnum == STAT_PROJECTILE)
{ {
int32_t i, nexti; int32_t i, nexti;
@ -399,14 +411,11 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
{ {
ActorExtra[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); ActorExtra[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
sprite[spritenum].x += (sprite[OW].x-SX); spr->x += (sprite[OW].x-SX);
sprite[spritenum].y += (sprite[OW].y-SY); spr->y += (sprite[OW].y-SY);
sprite[spritenum].z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz; spr->z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz;
ActorExtra[spritenum].bposx = sprite[spritenum].x;
ActorExtra[spritenum].bposy = sprite[spritenum].y;
ActorExtra[spritenum].bposz = sprite[spritenum].z;
Bmemcpy(&ActorExtra[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t));
changespritesect(spritenum,sprite[OW].sectnum); changespritesect(spritenum,sprite[OW].sectnum);
} }
@ -418,14 +427,11 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
if (totalclock > ActorExtra[spritenum].lasttransport) if (totalclock > ActorExtra[spritenum].lasttransport)
{ {
ActorExtra[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); ActorExtra[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
sprite[spritenum].x += (sprite[OW].x-SX); spr->x += (sprite[OW].x-SX);
sprite[spritenum].y += (sprite[OW].y-SY); spr->y += (sprite[OW].y-SY);
sprite[spritenum].z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz;
ActorExtra[spritenum].bposx = sprite[spritenum].x;
ActorExtra[spritenum].bposy = sprite[spritenum].y;
ActorExtra[spritenum].bposz = sprite[spritenum].z;
Bmemcpy(&ActorExtra[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t));
changespritesect(spritenum,sprite[OW].sectnum); changespritesect(spritenum,sprite[OW].sectnum);
} }
@ -438,20 +444,17 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
return(retval); return(retval);
} }
inline int32_t A_SetSprite(int32_t i,uint32_t cliptype) //The set sprite function inline int32_t A_SetSprite(int32_t i,uint32_t cliptype)
{ {
vec3_t davect; vec3_t davect = { (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14,
(sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,
davect.x = (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14; sprite[i].zvel };
davect.y = (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14;
davect.z = sprite[i].zvel;
return (A_MoveSprite(i,&davect,cliptype)==0); return (A_MoveSprite(i,&davect,cliptype)==0);
} }
#undef deletesprite
int32_t block_deletesprite = 0; int32_t block_deletesprite = 0;
// all calls to deletesprite() from the game are wrapped by this function
void A_DeleteSprite(int32_t s) void A_DeleteSprite(int32_t s)
{ {
if (block_deletesprite) if (block_deletesprite)
@ -479,9 +482,10 @@ void A_DeleteSprite(int32_t s)
} }
#endif #endif
#undef deletesprite
deletesprite(s); deletesprite(s);
}
#define deletesprite A_DeleteSprite #define deletesprite A_DeleteSprite
}
void A_AddToDeleteQueue(int32_t i) void A_AddToDeleteQueue(int32_t i)
{ {
@ -1002,7 +1006,7 @@ BOLT:
int32_t otherp; int32_t otherp;
static void G_MovePlayers(void) //Players static void G_MovePlayers(void)
{ {
int32_t i = headspritestat[STAT_PLAYER], nexti; int32_t i = headspritestat[STAT_PLAYER], nexti;
int32_t otherx; int32_t otherx;
@ -1091,10 +1095,7 @@ static void G_MovePlayers(void) //Players
if (p->holoduke_on == -1) if (p->holoduke_on == -1)
KILLIT(i); KILLIT(i);
ActorExtra[i].bposx = s->x; Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t));
ActorExtra[i].bposy = s->y;
ActorExtra[i].bposz = s->z;
s->cstat = 0; s->cstat = 0;
if (s->xrepeat < 42) if (s->xrepeat < 42)
@ -1354,9 +1355,7 @@ static void G_MoveStandables(void)
if (sect < 0) KILLIT(i); if (sect < 0) KILLIT(i);
ActorExtra[i].bposx = s->x; Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t));
ActorExtra[i].bposy = s->y;
ActorExtra[i].bposz = s->z;
IFWITHIN(CRANE,CRANE+3) IFWITHIN(CRANE,CRANE+3)
{ {
@ -1530,9 +1529,7 @@ static void G_MoveStandables(void)
{ {
setsprite(s->owner,(vec3_t *)s); setsprite(s->owner,(vec3_t *)s);
ActorExtra[s->owner].bposx = s->x; Bmemcpy(&ActorExtra[s->owner].bposx, s, sizeof(vec3_t));
ActorExtra[s->owner].bposy = s->y;
ActorExtra[s->owner].bposz = s->z;
s->zvel = 0; s->zvel = 0;
} }
@ -2353,9 +2350,7 @@ static void G_MoveWeapons(void)
if (s->sectnum < 0) KILLIT(i); if (s->sectnum < 0) KILLIT(i);
ActorExtra[i].bposx = s->x; Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t));
ActorExtra[i].bposy = s->y;
ActorExtra[i].bposz = s->z;
// here // here
if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE)) if (A_CheckSpriteFlags(i,SPRITE_PROJECTILE))
@ -3354,9 +3349,7 @@ static void G_MoveTransports(void)
sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz; sprite[j].z -= SZ - sector[sprite[OW].sectnum].floorz;
sprite[j].ang = sprite[OW].ang; sprite[j].ang = sprite[OW].ang;
ActorExtra[j].bposx = sprite[j].x; Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t));
ActorExtra[j].bposy = sprite[j].y;
ActorExtra[j].bposz = sprite[j].z;
if (sprite[i].pal == 0) if (sprite[i].pal == 0)
{ {
@ -3382,9 +3375,7 @@ static void G_MoveTransports(void)
sprite[j].y += (sprite[OW].y-SY); sprite[j].y += (sprite[OW].y-SY);
sprite[j].z = sprite[OW].z+4096; sprite[j].z = sprite[OW].z+4096;
ActorExtra[j].bposx = sprite[j].x; Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t));
ActorExtra[j].bposy = sprite[j].y;
ActorExtra[j].bposz = sprite[j].z;
changespritesect(j,sprite[OW].sectnum); changespritesect(j,sprite[OW].sectnum);
} }
@ -3396,9 +3387,8 @@ static void G_MoveTransports(void)
sprite[j].y += (sprite[OW].y-SY); sprite[j].y += (sprite[OW].y-SY);
sprite[j].z = sector[sprite[OW].sectnum].ceilingz; sprite[j].z = sector[sprite[OW].sectnum].ceilingz;
ActorExtra[j].bposx = sprite[j].x;
ActorExtra[j].bposy = sprite[j].y; Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t));
ActorExtra[j].bposz = sprite[j].z;
changespritesect(j,sprite[OW].sectnum); changespritesect(j,sprite[OW].sectnum);
@ -3409,9 +3399,7 @@ static void G_MoveTransports(void)
sprite[j].y += (sprite[OW].y-SY); sprite[j].y += (sprite[OW].y-SY);
sprite[j].z = sector[sprite[OW].sectnum].floorz; sprite[j].z = sector[sprite[OW].sectnum].floorz;
ActorExtra[j].bposx = sprite[j].x; Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t));
ActorExtra[j].bposy = sprite[j].y;
ActorExtra[j].bposz = sprite[j].z;
changespritesect(j,sprite[OW].sectnum); changespritesect(j,sprite[OW].sectnum);
@ -3466,9 +3454,8 @@ static void G_MoveActors(void)
t = &ActorExtra[i].temp_data[0]; t = &ActorExtra[i].temp_data[0];
ActorExtra[i].bposx = s->x; Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t));
ActorExtra[i].bposy = s->y;
ActorExtra[i].bposz = s->z;
switchpicnum=s->picnum; switchpicnum=s->picnum;
if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7)) if ((s->picnum > GREENSLIME)&&(s->picnum <= GREENSLIME+7))
{ {
@ -4814,9 +4801,8 @@ static void G_MoveMisc(void) // STATNUM 5
if (sect < 0 || s->xrepeat == 0) KILLIT(i); if (sect < 0 || s->xrepeat == 0) KILLIT(i);
ActorExtra[i].bposx = s->x; Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t));
ActorExtra[i].bposy = s->y;
ActorExtra[i].bposz = s->z;
switchpicnum = s->picnum; switchpicnum = s->picnum;
if ((s->picnum > NUKEBUTTON)&&(s->picnum <= NUKEBUTTON+3)) if ((s->picnum > NUKEBUTTON)&&(s->picnum <= NUKEBUTTON+3))
{ {
@ -6656,9 +6642,7 @@ static void G_MoveEffectors(void) //STATNUM 3
sprite[k].z = sector[sprite[j].sectnum].floorz- sprite[k].z = sector[sprite[j].sectnum].floorz-
(sc->floorz-sprite[k].z); (sc->floorz-sprite[k].z);
ActorExtra[k].bposx = sprite[k].x; Bmemcpy(&ActorExtra[k].bposx, &sprite[k], sizeof(vec3_t));
ActorExtra[k].bposy = sprite[k].y;
ActorExtra[k].bposz = sprite[k].z;
changespritesect(k,sprite[j].sectnum); changespritesect(k,sprite[j].sectnum);
setsprite(k,(vec3_t *)&sprite[k]); setsprite(k,(vec3_t *)&sprite[k]);

View file

@ -972,6 +972,7 @@ enum ProjectileFlags_t {
PROJECTILE_ACCURATE_AUTOAIM = 131072, PROJECTILE_ACCURATE_AUTOAIM = 131072,
PROJECTILE_FORCEIMPACT = 262144, PROJECTILE_FORCEIMPACT = 262144,
PROJECTILE_REALCLIPDIST = 524288, PROJECTILE_REALCLIPDIST = 524288,
PROJECTILE_ACCURATE = 1048576,
}; };
extern projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES]; extern projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES];

View file

@ -890,6 +890,7 @@ void Net_GetPackets(void)
for (; i-j<10; i++) g_player[other].wchoice[i-j] = packbuf[i]; for (; i-j<10; i++) g_player[other].wchoice[i-j] = packbuf[i];
break; break;
case PACKET_RTS: case PACKET_RTS:
//slaves in M/S mode only send to master //slaves in M/S mode only send to master
//Master re-transmits message to all others //Master re-transmits message to all others
@ -904,6 +905,7 @@ void Net_GetPackets(void)
rtsptr = (char *)RTS_GetSound(packbuf[1]-1); rtsptr = (char *)RTS_GetSound(packbuf[1]-1);
FX_PlayAuto3D(rtsptr,RTS_SoundLength(packbuf[1]-1),0,0,0,255,-packbuf[1]); FX_PlayAuto3D(rtsptr,RTS_SoundLength(packbuf[1]-1),0,0,0,255,-packbuf[1]);
g_RTSPlaying = 7; g_RTSPlaying = 7;
break; break;
case PACKET_MENU_LEVEL_QUIT: case PACKET_MENU_LEVEL_QUIT:
@ -1406,12 +1408,7 @@ void faketimerhandler(void)
} }
extern int32_t cacnum; extern int32_t cacnum;
typedef struct typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype;
{
int32_t *hand, leng;
char *lock ;
}
cactype;
extern cactype cac[]; extern cactype cac[];
static void G_ShowCacheLocks(void) static void G_ShowCacheLocks(void)
@ -1965,7 +1962,11 @@ static void G_DrawStatusBar(int32_t snum)
rotatesprite(sbarx(62+1),sbary(200-25+1),sbarsc(49152L),0,SHIELD,0,4,10+16+POLYMOSTTRANS2,0,0,xdim-1,ydim-1); rotatesprite(sbarx(62+1),sbary(200-25+1),sbarsc(49152L),0,SHIELD,0,4,10+16+POLYMOSTTRANS2,0,0,xdim-1,ydim-1);
rotatesprite(sbarx(62),sbary(200-25),sbarsc(49152L),0,SHIELD,0,0,10+16,0,0,xdim-1,ydim-1); rotatesprite(sbarx(62),sbary(200-25),sbarsc(49152L),0,SHIELD,0,0,10+16,0,0,xdim-1,ydim-1);
G_DrawAltDigiNum(105,-(200-22),p->shield_amount,-16,10+16); {
int32_t lAmount=Gv_GetVarByLabel("PLR_MORALE",-1, p->i, snum);
if (lAmount == -1) lAmount = p->shield_amount;
G_DrawAltDigiNum(105,-(200-22),lAmount,-16,10+16);
}
if (getrendermode() >= 3 && althud_shadows) if (getrendermode() >= 3 && althud_shadows)
{ {
@ -3411,11 +3412,10 @@ void G_GetCrosshairColor(void)
ptr++; ptr++;
ii--; ii--;
} }
while (ii > 0); while (ii);
DefaultCrosshairColors.r = CrosshairColors.r = curpalette[bri].r; Bmemcpy(&CrosshairColors, &curpalette[bri], sizeof(palette_t));
DefaultCrosshairColors.g = CrosshairColors.g = curpalette[bri].g; Bmemcpy(&DefaultCrosshairColors, &curpalette[bri], sizeof(palette_t));
DefaultCrosshairColors.b = CrosshairColors.b = curpalette[bri].b;
DefaultCrosshairColors.f = 1; // this flag signifies that the color has been detected DefaultCrosshairColors.f = 1; // this flag signifies that the color has been detected
} }
} }
@ -3452,7 +3452,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
ptr++; ptr++;
ii--; ii--;
} }
while (ii > 0); while (ii);
for (i = 255; i >= 0; i--) for (i = 255; i >= 0; i--)
tempbuf[i] = i; tempbuf[i] = i;
@ -3460,9 +3460,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
makepalookup(CROSSHAIR_PAL,tempbuf,CrosshairColors.r>>2, CrosshairColors.g>>2, CrosshairColors.b>>2,1); makepalookup(CROSSHAIR_PAL,tempbuf,CrosshairColors.r>>2, CrosshairColors.g>>2, CrosshairColors.b>>2,1);
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
hictinting[CROSSHAIR_PAL].r = CrosshairColors.r; Bmemcpy(&hictinting[CROSSHAIR_PAL], &CrosshairColors, sizeof(palette_t));
hictinting[CROSSHAIR_PAL].g = CrosshairColors.g;
hictinting[CROSSHAIR_PAL].b = CrosshairColors.b;
hictinting[CROSSHAIR_PAL].f = 9; hictinting[CROSSHAIR_PAL].f = 9;
#endif #endif
invalidatetile(CROSSHAIR, -1, -1); invalidatetile(CROSSHAIR, -1, -1);
@ -3471,19 +3469,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e) void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e)
{ {
int32_t tc; int32_t tc;
/*
for(i=0;i<768;i+=3)
{
temparray[i ] =
g_player[myconnectindex].ps->palette[i+0]+((((int32_t)r-(int32_t)g_player[myconnectindex].ps->palette[i+0])*(int32_t)(e&127))>>6);
temparray[i+1] =
g_player[myconnectindex].ps->palette[i+1]+((((int32_t)g-(int32_t)g_player[myconnectindex].ps->palette[i+1])*(int32_t)(e&127))>>6);
temparray[i+2] =
g_player[myconnectindex].ps->palette[i+2]+((((int32_t)b-(int32_t)g_player[myconnectindex].ps->palette[i+2])*(int32_t)(e&127))>>6);
}
*/
//setbrightness(ud.brightness>>2,temparray);
setpalettefade(r,g,b,e&127); setpalettefade(r,g,b,e&127);
if (getrendermode() >= 3) pus = pub = NUMPAGES; // JBF 20040110: redraw the status bar next time if (getrendermode() >= 3) pus = pub = NUMPAGES; // JBF 20040110: redraw the status bar next time
if ((e&128) == 0) if ((e&128) == 0)
@ -3508,45 +3494,36 @@ void G_DisplayRest(int32_t smoothratio)
// this takes care of fullscreen tint for OpenGL // this takes care of fullscreen tint for OpenGL
if (getrendermode() >= 3) if (getrendermode() >= 3)
{ {
#if 0
if (pp->palette == waterpal) tintr=0,tintg=0,tintb=63,tintf=8;
else if (pp->palette == slimepal) tintr=20,tintg=63,tintb=20,tintf=8;
#else
if (pp->palette == waterpal) if (pp->palette == waterpal)
{ {
if (hictinting[MAXPALOOKUPS-2].r == 255 && hictinting[MAXPALOOKUPS-2].g == 255 && hictinting[MAXPALOOKUPS-2].b == 255) // if ((*(uint32_t *)&hictinting[MAXPALOOKUPS-2].r)|0x000000FF) == 0xFFFFFFFF)
{ {
hictinting[MAXPALOOKUPS-1].r = 192; static palette_t wp = { 224, 192, 255, 0 };
hictinting[MAXPALOOKUPS-1].g = 192; Bmemcpy(&hictinting[MAXPALOOKUPS-1], &wp, sizeof(palette_t));
hictinting[MAXPALOOKUPS-1].b = 255;
} }
else Bmemcpy(&hictinting[MAXPALOOKUPS-1],&hictinting[MAXPALOOKUPS-2],sizeof(hictinting[0])); // else Bmemcpy(&hictinting[MAXPALOOKUPS-1], &hictinting[MAXPALOOKUPS-2], sizeof(palette_t));
} }
else if (pp->palette == slimepal) else if (pp->palette == slimepal)
{ {
if (hictinting[MAXPALOOKUPS-3].r == 255 && hictinting[MAXPALOOKUPS-3].g == 255 && hictinting[MAXPALOOKUPS-3].b == 255) // if ((*(uint32_t *)&hictinting[MAXPALOOKUPS-3].r)|0x000000FF) == 0xFFFFFFFF)
{ {
hictinting[MAXPALOOKUPS-1].r = 208; static palette_t sp = { 208, 255, 192, 0 };
hictinting[MAXPALOOKUPS-1].g = 255; Bmemcpy(&hictinting[MAXPALOOKUPS-1], &sp, sizeof(palette_t));
hictinting[MAXPALOOKUPS-1].b = 192;
} }
else Bmemcpy(&hictinting[MAXPALOOKUPS-1],&hictinting[MAXPALOOKUPS-3],sizeof(hictinting[0]));
// else Bmemcpy(&hictinting[MAXPALOOKUPS-1], &hictinting[MAXPALOOKUPS-3], sizeof(palette_t));
} }
else else
{ {
hictinting[MAXPALOOKUPS-1].r = 255; *(uint32_t *)&hictinting[MAXPALOOKUPS-1].r = 0xFFFFFFFF;
hictinting[MAXPALOOKUPS-1].g = 255;
hictinting[MAXPALOOKUPS-1].b = 255;
} }
#endif
} }
#endif /* USE_OPENGL && POLYMOST */ #endif /* USE_OPENGL && POLYMOST */
// this does pain tinting etc from the CON // this does pain tinting etc from the CON
if (pp->pals_time >= 0 && pp->loogcnt == 0) // JBF 20040101: pals_time > 0 now >= 0 if (pp->pals_time >= 0 && pp->loogcnt == 0) // JBF 20040101: pals_time > 0 now >= 0
{ {
tempFade.r = pp->pals[0]; // tempFade = (palette_t) { pp->pals[0], pp->pals[1], pp->pals[2], pp->pals_time };
tempFade.g = pp->pals[1]; Bmemcpy(&tempFade, &pp->pals, sizeof(palette_t));
tempFade.b = pp->pals[2];
tempFade.f = pp->pals_time; tempFade.f = pp->pals_time;
g_restorePalette = 1; // JBF 20040101 g_restorePalette = 1; // JBF 20040101
applyTint = 1; applyTint = 1;
@ -3562,19 +3539,12 @@ void G_DisplayRest(int32_t smoothratio)
else if (pp->loogcnt > 0) else if (pp->loogcnt > 0)
{ {
//G_FadePalette(0,64,0,(pp->loogcnt>>1)+128); //G_FadePalette(0,64,0,(pp->loogcnt>>1)+128);
tempFade.r = 0; palette_t lp = { 0, 64, 0, pp->loogcnt>>1 };
tempFade.g = 64; Bmemcpy(&tempFade, &lp, sizeof(palette_t));
tempFade.b = 0;
tempFade.f = pp->loogcnt>>1;
applyTint = 1; applyTint = 1;
} }
if (tempFade.f > tempTint.f) if (tempFade.f > tempTint.f)
{ Bmemcpy(&tempTint, &tempFade, sizeof(palette_t));
tempTint.r = tempFade.r;
tempTint.g = tempFade.g;
tempTint.b = tempFade.b;
tempTint.f = tempFade.f;
}
if (ud.show_help) if (ud.show_help)
{ {
@ -3639,7 +3609,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on > 0) if (ud.overhead_on > 0)
{ {
// smoothratio = min(max(smoothratio,0),65536); // smoothratio = min(max(smoothratio,0),65536);
smoothratio = min(max((totalclock - ototalclock) * (65536 / TICSPERFRAME),0),65536); smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536);
G_DoInterpolations(smoothratio); G_DoInterpolations(smoothratio);
if (ud.scrollmode == 0) if (ud.scrollmode == 0)
{ {
@ -3711,11 +3681,11 @@ void G_DisplayRest(int32_t smoothratio)
{ {
int32_t bits = 10+16; int32_t bits = 10+16;
if (g_levelTextTime > 4) if (g_levelTextTime < 3)
bits = bits; bits |= 1+32;
else if (g_levelTextTime > 2) else if (g_levelTextTime < 5)
bits |= 1; bits |= 1;
else bits |= 1+32;
if (MapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL) if (MapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL)
{ {
if (currentboardfilename[0] != 0 && ud.volume_number == 0 && ud.level_number == 7) if (currentboardfilename[0] != 0 && ud.volume_number == 0 && ud.level_number == 7)
@ -3869,8 +3839,8 @@ static void G_DoThirdPerson(DukePlayer_t *pp, vec3_t *vect,int16_t *vsectnum, in
int32_t nx = (sintable[(ang+1536)&2047]>>4); int32_t nx = (sintable[(ang+1536)&2047]>>4);
int32_t ny = (sintable[(ang+1024)&2047]>>4); int32_t ny = (sintable[(ang+1024)&2047]>>4);
int32_t nz = (horiz-100)*128; int32_t nz = (horiz-100)*128;
int16_t daang; int32_t daang;
int16_t bakcstat = sp->cstat; int32_t bakcstat = sp->cstat;
hitdata_t hitinfo; hitdata_t hitinfo;
sp->cstat &= (int16_t)~0x101; sp->cstat &= (int16_t)~0x101;
@ -4220,7 +4190,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
return; return;
// smoothratio = min(max(smoothratio,0),65536); // smoothratio = min(max(smoothratio,0),65536);
smoothratio = min(max((totalclock - ototalclock) * (65536 / TICSPERFRAME),0),65536); smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536);
visibility = (int32_t)(p->visibility*(numplayers>1?1.f:r_ambientlightrecip)); visibility = (int32_t)(p->visibility*(numplayers>1?1.f:r_ambientlightrecip));
@ -4323,18 +4293,22 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
if ((snum == myconnectindex) && (numplayers > 1)) if ((snum == myconnectindex) && (numplayers > 1))
{ {
ud.camera.x = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio); vec3_t cam = { omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio),
ud.camera.y = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio); omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio),
ud.camera.z = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio); omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio) };
Bmemcpy(&ud.camera, &cam, sizeof(vec3_t));
ud.cameraang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio); ud.cameraang = omyang+mulscale16((int32_t)(((myang+1024-omyang)&2047)-1024),smoothratio);
ud.camerahoriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio); ud.camerahoriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio);
ud.camerasect = mycursectnum; ud.camerasect = mycursectnum;
} }
else else
{ {
ud.camera.x = p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio); vec3_t cam = { p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio),
ud.camera.y = p->oposy+mulscale16((int32_t)(p->posy-p->oposy),smoothratio); p->oposy+mulscale16((int32_t)(p->posy-p->oposy),smoothratio),
ud.camera.z = p->oposz+mulscale16((int32_t)(p->posz-p->oposz),smoothratio); p->oposz+mulscale16((int32_t)(p->posz-p->oposz),smoothratio) };
Bmemcpy(&ud.camera, &cam, sizeof(vec3_t));
ud.cameraang = p->oang+mulscale16((int32_t)(((p->ang+1024-p->oang)&2047)-1024),smoothratio); ud.cameraang = p->oang+mulscale16((int32_t)(((p->ang+1024-p->oang)&2047)-1024),smoothratio);
ud.camerahoriz = p->ohoriz+p->ohorizoff+mulscale16((int32_t)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio); ud.camerahoriz = p->ohoriz+p->ohorizoff+mulscale16((int32_t)(p->horiz+p->horizoff-p->ohoriz-p->ohorizoff),smoothratio);
} }
@ -4344,9 +4318,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio)
{ {
ud.cameraang = p->ang+p->look_ang; ud.cameraang = p->ang+p->look_ang;
ud.camerahoriz = p->horiz+p->horizoff; ud.camerahoriz = p->horiz+p->horizoff;
ud.camera.x = p->posx; Bmemcpy(&ud.camera, p, sizeof(vec3_t));
ud.camera.y = p->posy;
ud.camera.z = p->posz;
ud.camerasect = sprite[p->newowner].sectnum; ud.camerasect = sprite[p->newowner].sectnum;
smoothratio = 65536L; smoothratio = 65536L;
} }
@ -4581,44 +4553,25 @@ static void G_DumpDebugInfo(void)
int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss) int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int32_t s_pn,int32_t s_s,int32_t s_xr,int32_t s_yr,int32_t s_a,int32_t s_ve,int32_t s_zv,int32_t s_ow,int32_t s_ss)
{ {
int32_t i = insertsprite(whatsect,s_ss); int32_t p, i = insertsprite(whatsect,s_ss);
int32_t p;
spritetype *s = &sprite[i]; spritetype *s = &sprite[i];
spritetype spr_temp = { s_x, s_y, s_z, 0, s_pn, s_s, 0, 0, 0, s_xr, s_yr, 0, 0,
whatsect, s_ss, s_a, s_ow, s_ve, 0, s_zv, 0, 0, 0 };
if (i < 0) if (i < 0)
{ {
G_DumpDebugInfo(); G_DumpDebugInfo();
OSD_Printf("Failed spawning sprite with tile %d from sprite %d (%d) at x:%d,y:%d,z:%d,sector:%d\n",s_pn,s_ow,sprite[s_ow].picnum,s_x,s_y,s_z,whatsect); OSD_Printf("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n",
s_pn,sprite[s_ow].picnum,s_ow,s_x,s_y,s_z,whatsect);
G_GameExit("Too many sprites spawned."); G_GameExit("Too many sprites spawned.");
} }
Bmemcpy(s, &spr_temp, sizeof(spritetype));
Bmemset(&ActorExtra[i], 0, sizeof(ActorData_t));
Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t)); // update bposx/y/z
ActorExtra[i].projectile = &SpriteProjectile[i]; ActorExtra[i].projectile = &SpriteProjectile[i];
ActorExtra[i].bposx = s_x;
ActorExtra[i].bposy = s_y;
ActorExtra[i].bposz = s_z;
s->x = s_x;
s->y = s_y;
s->z = s_z;
s->cstat = 0;
s->picnum = s_pn;
s->shade = s_s;
s->xrepeat = s_xr;
s->yrepeat = s_yr;
s->pal = 0;
s->ang = s_a;
s->xvel = s_ve;
s->zvel = s_zv;
s->owner = s_ow;
s->xoffset = 0;
s->yoffset = 0;
s->yvel = 0;
s->clipdist = 0;
s->pal = 0;
s->lotag = 0;
if (s_ow > -1 && s_ow < MAXSPRITES) if (s_ow > -1 && s_ow < MAXSPRITES)
{ {
ActorExtra[i].picnum = sprite[s_ow].picnum; ActorExtra[i].picnum = sprite[s_ow].picnum;
@ -4626,24 +4579,8 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
ActorExtra[i].ceilingz = ActorExtra[s_ow].ceilingz; ActorExtra[i].ceilingz = ActorExtra[s_ow].ceilingz;
} }
ActorExtra[i].lastvx = 0; ActorExtra[i].actorstayput = ActorExtra[i].extra = ActorExtra[i].lightId = -1;
ActorExtra[i].lastvy = 0;
ActorExtra[i].timetosleep = 0;
ActorExtra[i].actorstayput = -1;
ActorExtra[i].extra = -1;
ActorExtra[i].owner = s_ow; ActorExtra[i].owner = s_ow;
ActorExtra[i].cgg = 0;
ActorExtra[i].movflag = 0;
ActorExtra[i].tempang = 0;
ActorExtra[i].dispicnum = 0;
ActorExtra[i].lightptr = NULL;
ActorExtra[i].lightId = -1;
T1=T3=T4=T6=T7=T8=T9=0;
ActorExtra[i].flags = 0;
// sprpos[i].ang = sprpos[i].oldang = sprite[i].ang; // sprpos[i].ang = sprpos[i].oldang = sprite[i].ang;
@ -4654,12 +4591,6 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
T2 = *(actorscrptr[s_pn]+2); T2 = *(actorscrptr[s_pn]+2);
s->hitag = *(actorscrptr[s_pn]+3); s->hitag = *(actorscrptr[s_pn]+3);
} }
else
{
T2=T5=0;
s->extra = 0;
s->hitag = 0;
}
if (show2dsector[SECT>>3]&(1<<(SECT&7))) show2dsprite[i>>3] |= (1<<(i&7)); if (show2dsector[SECT>>3]&(1<<(SECT&7))) show2dsprite[i>>3] |= (1<<(i&7));
else show2dsprite[i>>3] &= ~(1<<(i&7)); else show2dsprite[i>>3] &= ~(1<<(i&7));
@ -4667,20 +4598,12 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
clearbufbyte(&spriteext[i], sizeof(spriteext_t), 0); clearbufbyte(&spriteext[i], sizeof(spriteext_t), 0);
clearbufbyte(&spritesmooth[i], sizeof(spritesmooth_t), 0); clearbufbyte(&spritesmooth[i], sizeof(spritesmooth_t), 0);
/*
if(s->sectnum < 0)
{
s->xrepeat = s->yrepeat = 0;
changespritestat(i,5);
}
*/
A_ResetVars(i); A_ResetVars(i);
ActorExtra[i].flags = 0;
if (apScriptGameEvent[EVENT_EGS]) if (apScriptGameEvent[EVENT_EGS])
{ {
extern int32_t block_deletesprite; extern int32_t block_deletesprite;
int32_t pl=A_FindPlayer(&sprite[i],&p); int32_t pl=A_FindPlayer(s, &p);
block_deletesprite++; block_deletesprite++;
X_OnEvent(EVENT_EGS, i, pl, p); X_OnEvent(EVENT_EGS, i, pl, p);
@ -4705,34 +4628,19 @@ int32_t A_Spawn(int32_t j, int32_t pn)
else else
{ {
i = pn; i = pn;
Bmemset(&ActorExtra[i], 0, sizeof(ActorData_t));
Bmemcpy(&ActorExtra[i].bposx, &sprite[i], sizeof(vec3_t));
ActorExtra[i].picnum = PN; ActorExtra[i].picnum = PN;
ActorExtra[i].timetosleep = 0;
ActorExtra[i].extra = -1;
ActorExtra[i].projectile = &SpriteProjectile[i]; ActorExtra[i].projectile = &SpriteProjectile[i];
ActorExtra[i].bposx = SX;
ActorExtra[i].bposy = SY;
ActorExtra[i].bposz = SZ;
OW = ActorExtra[i].owner = i; OW = ActorExtra[i].owner = i;
ActorExtra[i].cgg = 0;
ActorExtra[i].movflag = 0;
ActorExtra[i].tempang = 0;
ActorExtra[i].dispicnum = 0;
ActorExtra[i].floorz = sector[SECT].floorz; ActorExtra[i].floorz = sector[SECT].floorz;
ActorExtra[i].ceilingz = sector[SECT].ceilingz; ActorExtra[i].ceilingz = sector[SECT].ceilingz;
ActorExtra[i].lastvx = 0; ActorExtra[i].actorstayput = ActorExtra[i].lightId = ActorExtra[i].extra = -1;
ActorExtra[i].lastvy = 0;
ActorExtra[i].actorstayput = -1;
ActorExtra[i].lightptr = NULL;
ActorExtra[i].lightId = -1;
T1 = T2 = T3 = T4 = T5 = T6 = T7 = T8 = T9 = 0;
ActorExtra[i].flags = 0;
// sprpos[i].ang = sprpos[i].oldang = sprite[i].ang; // sprpos[i].ang = sprpos[i].oldang = sprite[i].ang;
@ -4806,7 +4714,6 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{ {
sp->xrepeat = sp->yrepeat = 0; sp->xrepeat = sp->yrepeat = 0;
changespritestat(i,5); changespritestat(i,5);
} }
else else
{ {
@ -4952,10 +4859,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
else else
{ {
if (sprite[j].statnum == STAT_PROJECTILE) if (sprite[j].statnum == STAT_PROJECTILE)
{ sp->xrepeat = sp->yrepeat = 8;
sp->xrepeat = 8;
sp->yrepeat = 8;
}
else else
{ {
sp->xrepeat = 48; sp->xrepeat = 48;
@ -5130,8 +5034,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
sp->xrepeat=4; sp->xrepeat=4;
sp->yrepeat=5; sp->yrepeat=5;
sp->owner = i; sp->owner = sp->hitag = i;
sp->hitag = i;
sp->xvel = 16; sp->xvel = 16;
A_SetSprite(i,CLIPMASK0); A_SetSprite(i,CLIPMASK0);
@ -5409,8 +5312,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
case VIEWSCREEN__STATIC: case VIEWSCREEN__STATIC:
case VIEWSCREEN2__STATIC: case VIEWSCREEN2__STATIC:
sp->owner = i; sp->owner = i;
sp->lotag = 1; sp->lotag = sp->extra = 1;
sp->extra = 1;
changespritestat(i,6); changespritestat(i,6);
break; break;
@ -5494,27 +5396,19 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT)
{ {
sp->xrepeat = 48; sp->xrepeat = sp->yrepeat = 48;
sp->yrepeat = 48;
sp->shade = -127; sp->shade = -127;
sp->cstat |= 128; sp->cstat |= 128;
} }
else if (sp->picnum == SHRINKEREXPLOSION) else if (sp->picnum == SHRINKEREXPLOSION)
{ sp->xrepeat = sp->yrepeat = 32;
sp->xrepeat = 32;
sp->yrepeat = 32;
}
else if (sp->picnum == SMALLSMOKE) else if (sp->picnum == SMALLSMOKE)
{ {
// 64 "money" // 64 "money"
sp->xrepeat = 24; sp->xrepeat = sp->yrepeat = 24;
sp->yrepeat = 24;
} }
else if (sp->picnum == BURNING || sp->picnum == BURNING2) else if (sp->picnum == BURNING || sp->picnum == BURNING2)
{ sp->xrepeat = sp->yrepeat = 4;
sp->xrepeat = 4;
sp->yrepeat = 4;
}
if (j >= 0) if (j >= 0)
{ {
@ -5633,10 +5527,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
sp->ang = krand()&2047; sp->ang = krand()&2047;
case WATERDRIPSPLASH__STATIC: case WATERDRIPSPLASH__STATIC:
sp->xrepeat = sp->yrepeat = 24;
sp->xrepeat = 24;
sp->yrepeat = 24;
changespritestat(i,6); changespritestat(i,6);
break; break;
@ -5748,13 +5639,11 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (sp->pal) if (sp->pal)
{ {
sp->clipdist = 80; sp->clipdist = 80;
sp->xrepeat = 40; sp->xrepeat = sp->yrepeat = 40;
sp->yrepeat = 40;
} }
else else
{ {
sp->xrepeat = 80; sp->xrepeat = sp->yrepeat = 80;
sp->yrepeat = 80;
sp->clipdist = 164; sp->clipdist = 164;
} }
} }
@ -5762,14 +5651,12 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{ {
if (sp->picnum != SHARK) if (sp->picnum != SHARK)
{ {
sp->xrepeat = 40; sp->xrepeat = sp->yrepeat = 40;
sp->yrepeat = 40;
sp->clipdist = 80; sp->clipdist = 80;
} }
else else
{ {
sp->xrepeat = 60; sp->xrepeat = sp->yrepeat = 60;
sp->yrepeat = 60;
sp->clipdist = 40; sp->clipdist = 40;
} }
} }
@ -6502,7 +6389,6 @@ int32_t A_Spawn(int32_t j, int32_t pn)
case SEENINE__STATIC: case SEENINE__STATIC:
case OOZFILTER__STATIC: case OOZFILTER__STATIC:
sp->shade = -16; sp->shade = -16;
if (sp->xrepeat <= 8) if (sp->xrepeat <= 8)
{ {
@ -6553,6 +6439,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
sp->clipdist = 8; sp->clipdist = 8;
sp->owner = i; sp->owner = i;
break; break;
case CANWITHSOMETHING__STATIC: case CANWITHSOMETHING__STATIC:
case CANWITHSOMETHING2__STATIC: case CANWITHSOMETHING2__STATIC:
case CANWITHSOMETHING3__STATIC: case CANWITHSOMETHING3__STATIC:
@ -6567,7 +6454,6 @@ int32_t A_Spawn(int32_t j, int32_t pn)
case NUKEBARRELDENTED__STATIC: case NUKEBARRELDENTED__STATIC:
case NUKEBARRELLEAKED__STATIC: case NUKEBARRELLEAKED__STATIC:
case WOODENHORSE__STATIC: case WOODENHORSE__STATIC:
if (j >= 0) if (j >= 0)
sp->xrepeat = sp->yrepeat = 32; sp->xrepeat = sp->yrepeat = 32;
sp->clipdist = 72; sp->clipdist = 72;
@ -6589,6 +6475,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
changespritestat(i, STAT_ZOMBIEACTOR); changespritestat(i, STAT_ZOMBIEACTOR);
} }
break; break;
case TOILETWATER__STATIC: case TOILETWATER__STATIC:
sp->shade = -16; sp->shade = -16;
changespritestat(i,6); changespritestat(i,6);
@ -6605,7 +6492,7 @@ SPAWN_END:
return i; return i;
} }
#ifdef _MSC_VER #if 0 // def _MSC_VER
// Visual C thought this was a bit too hard to optimise so we'd better // Visual C thought this was a bit too hard to optimise so we'd better
// tell it not to try... such a pussy it is. // tell it not to try... such a pussy it is.
//#pragma auto_inline(off) //#pragma auto_inline(off)
@ -7050,8 +6937,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
if (t->yrepeat < 4) t->yrepeat = 4; */ if (t->yrepeat < 4) t->yrepeat = 4; */
tsprite[spritesortcnt].shade = t->shade; tsprite[spritesortcnt].shade = t->shade;
tsprite[spritesortcnt].cstat = 0; tsprite[spritesortcnt].cstat = tsprite[spritesortcnt].pal = 0;
tsprite[spritesortcnt].pal = 0;
tsprite[spritesortcnt].picnum = (g_player[p].ps->curr_weapon==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[g_player[p].ps->curr_weapon]); tsprite[spritesortcnt].picnum = (g_player[p].ps->curr_weapon==GROW_WEAPON?GROWSPRITEICON:WeaponPickupSprites[g_player[p].ps->curr_weapon]);
@ -7060,15 +6946,10 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
else tsprite[spritesortcnt].z = s->z-(51<<8); else tsprite[spritesortcnt].z = s->z-(51<<8);
if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) if (tsprite[spritesortcnt].picnum == HEAVYHBOMB)
{ tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 10;
tsprite[spritesortcnt].xrepeat = 10;
tsprite[spritesortcnt].yrepeat = 10;
}
else else
{ tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 16;
tsprite[spritesortcnt].xrepeat = 16;
tsprite[spritesortcnt].yrepeat = 16;
}
spritesortcnt++; spritesortcnt++;
} }
@ -7079,17 +6960,17 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
tsprite[spritesortcnt].statnum = TSPR_TEMP; tsprite[spritesortcnt].statnum = TSPR_TEMP;
tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3);
if (t->yrepeat < 4) t->yrepeat = 4; if (tsprite[spritesortcnt].yrepeat < 4) tsprite[spritesortcnt].yrepeat = 4;
tsprite[spritesortcnt].cstat = 0; tsprite[spritesortcnt].cstat = 0;
tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN; tsprite[spritesortcnt].picnum = RESPAWNMARKERGREEN;
if (s->owner >= 0) if (s->owner >= 0)
tsprite[spritesortcnt].z = g_player[p].ps->posz-(20<<8); tsprite[spritesortcnt].z = g_player[p].ps->posz-(20<<8);
else tsprite[spritesortcnt].z = s->z-(96<<8); else
tsprite[spritesortcnt].xrepeat = 32; tsprite[spritesortcnt].z = s->z-(96<<8);
tsprite[spritesortcnt].yrepeat = 32;
tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 32;
tsprite[spritesortcnt].pal = 20; tsprite[spritesortcnt].pal = 20;
spritesortcnt++; spritesortcnt++;
} }
@ -7539,7 +7420,7 @@ PALONLY:
} }
} }
} }
#ifdef _MSC_VER #if 0 // def _MSC_VER
//#pragma auto_inline() //#pragma auto_inline()
#pragma optimize("",on) #pragma optimize("",on)
#endif #endif
@ -8956,7 +8837,7 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload)
{ "#include", T_INCLUDE }, { "#include", T_INCLUDE },
{ "loadgrp", T_LOADGRP }, { "loadgrp", T_LOADGRP },
{ "cachesize", T_CACHESIZE }, { "cachesize", T_CACHESIZE },
{ "noautload", T_NOAUTOLOAD }, { "noautoload", T_NOAUTOLOAD },
{ "music", T_MUSIC }, { "music", T_MUSIC },
{ "sound", T_SOUND }, { "sound", T_SOUND },
}; };
@ -9199,12 +9080,9 @@ static void G_AddPath(const char *buffer)
static void G_CheckCommandLine(int32_t argc, const char **argv) static void G_CheckCommandLine(int32_t argc, const char **argv)
{ {
int16_t i, j;
char *c;
int32_t firstnet = 0; int32_t firstnet = 0;
char *k; int16_t i = 1, j;
char *c, *k;
i = 1;
ud.fta_on = 1; ud.fta_on = 1;
ud.god = 0; ud.god = 0;
@ -9478,15 +9356,13 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if ((*c == '/') || (*c == '-')) if ((*c == '/') || (*c == '-'))
{ {
c++; c++;
switch (*c) switch (Btolower(*c))
{ {
case 'a': case 'a':
case 'A':
ud.playerai = 1; ud.playerai = 1;
initprintf("Other player AI.\n"); initprintf("Other player AI.\n");
break; break;
case 'c': case 'c':
case 'C':
c++; c++;
//if(*c == '1' || *c == '2' || *c == '3') //if(*c == '1' || *c == '2' || *c == '3')
@ -9515,7 +9391,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
//} //}
break; break;
case 'd': case 'd':
case 'D':
c++; c++;
if (strchr(c,'.') == 0) if (strchr(c,'.') == 0)
Bstrcat(c,".dmo"); Bstrcat(c,".dmo");
@ -9523,7 +9398,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
Bstrcpy(firstdemofile,c); Bstrcpy(firstdemofile,c);
break; break;
case 'f': case 'f':
case 'F':
c++; c++;
if (*c == '1') if (*c == '1')
g_movesPerPacket = 1; g_movesPerPacket = 1;
@ -9536,13 +9410,11 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
break; break;
case 'g': case 'g':
case 'G':
c++; c++;
if (!*c) break; if (!*c) break;
G_AddGroup(c); G_AddGroup(c);
break; break;
case 'h': case 'h':
case 'H':
c++; c++;
if (*c) if (*c)
{ {
@ -9551,26 +9423,22 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
break; break;
case 'i': case 'i':
case 'I':
c++; c++;
if (*c == '0') g_networkBroadcastMode = 0; if (*c == '0') g_networkBroadcastMode = 0;
if (*c == '1') g_networkBroadcastMode = 1; if (*c == '1') g_networkBroadcastMode = 1;
initprintf("Network Mode %d\n",g_networkBroadcastMode); initprintf("Network Mode %d\n",g_networkBroadcastMode);
break; break;
case 'j': case 'j':
case 'J':
c++; c++;
if (!*c) break; if (!*c) break;
G_AddPath(c); G_AddPath(c);
break; break;
case 'l': case 'l':
case 'L':
ud.warp_on = 1; ud.warp_on = 1;
c++; c++;
ud.m_level_number = ud.level_number = (atoi(c)-1)%MAXLEVELS; ud.m_level_number = ud.level_number = (atoi(c)-1)%MAXLEVELS;
break; break;
case 'm': case 'm':
case 'M':
if (*(c+1) != 'a' && *(c+1) != 'A') if (*(c+1) != 'a' && *(c+1) != 'A')
{ {
ud.m_monsters_off = 1; ud.m_monsters_off = 1;
@ -9579,7 +9447,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
break; break;
case 'n': case 'n':
case 'N':
c++; c++;
if (*c == 's' || *c == 'S') if (*c == 's' || *c == 'S')
{ {
@ -9608,7 +9475,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
break; break;
case 'q': case 'q':
case 'Q':
initprintf("Fake multiplayer mode.\n"); initprintf("Fake multiplayer mode.\n");
if (*(++c) == 0) ud.multimode = 1; if (*(++c) == 0) ud.multimode = 1;
else ud.multimode = atoi(c)%17; else ud.multimode = atoi(c)%17;
@ -9619,19 +9485,16 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
ud.m_respawn_inventory = ud.respawn_inventory = 1; ud.m_respawn_inventory = ud.respawn_inventory = 1;
break; break;
case 'r': case 'r':
case 'R':
ud.m_recstat = 1; ud.m_recstat = 1;
initprintf("Demo record mode on.\n"); initprintf("Demo record mode on.\n");
break; break;
case 's': case 's':
case 'S':
c++; c++;
ud.m_player_skill = ud.player_skill = (atoi(c)%5); ud.m_player_skill = ud.player_skill = (atoi(c)%5);
if (ud.m_player_skill == 4) if (ud.m_player_skill == 4)
ud.m_respawn_monsters = ud.respawn_monsters = 1; ud.m_respawn_monsters = ud.respawn_monsters = 1;
break; break;
case 't': case 't':
case 'T':
c++; c++;
if (*c == '1') ud.m_respawn_monsters = 1; if (*c == '1') ud.m_respawn_monsters = 1;
else if (*c == '2') ud.m_respawn_items = 1; else if (*c == '2') ud.m_respawn_items = 1;
@ -9645,7 +9508,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
initprintf("Respawn on.\n"); initprintf("Respawn on.\n");
break; break;
case 'u': case 'u':
case 'U':
CommandWeaponChoice = 1; CommandWeaponChoice = 1;
c++; c++;
j = 0; j = 0;
@ -9684,17 +9546,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
} }
break; break;
case 'v': case 'v':
case 'V':
c++; c++;
ud.warp_on = 1; ud.warp_on = 1;
ud.m_volume_number = ud.volume_number = atoi(c)-1; ud.m_volume_number = ud.volume_number = atoi(c)-1;
break; break;
case 'w': case 'w':
case 'W':
ud.coords = 1; ud.coords = 1;
break; break;
case 'x': case 'x':
case 'X':
c++; c++;
if (*c) if (*c)
{ {
@ -9716,7 +9575,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
ud.warp_on = 2 + (*c) - '0'; ud.warp_on = 2 + (*c) - '0';
break; break;
case 'z': case 'z':
case 'Z':
c++; c++;
g_scriptDebug = atoi(c); g_scriptDebug = atoi(c);
if (!g_scriptDebug) if (!g_scriptDebug)
@ -10023,6 +9881,7 @@ void G_Shutdown(void)
static void G_CompileScripts(void) static void G_CompileScripts(void)
{ {
int32_t i, psm = pathsearchmode; int32_t i, psm = pathsearchmode;
label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816 label = (char *)&sprite[0]; // V8: 16384*44/64 = 11264 V7: 4096*44/64 = 2816
labelcode = (intptr_t *)&sector[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240 labelcode = (intptr_t *)&sector[0]; // V8: 4096*40/4 = 40960 V7: 1024*40/4 = 10240
labeltype = (intptr_t *)&wall[0]; // V8: 16384*32/4 = 131072 V7: 8192*32/4 = 65536 labeltype = (intptr_t *)&wall[0]; // V8: 16384*32/4 = 131072 V7: 8192*32/4 = 65536
@ -10083,7 +9942,7 @@ static void G_CompileScripts(void)
pathsearchmode = psm; pathsearchmode = psm;
} }
static void G_CheckGametype(void) static inline void G_CheckGametype(void)
{ {
// initprintf("ud.m_coop=%i before sanitization\n",ud.m_coop); // initprintf("ud.m_coop=%i before sanitization\n",ud.m_coop);
ud.m_coop = clamp(ud.m_coop, 0, g_numGametypes-1); ud.m_coop = clamp(ud.m_coop, 0, g_numGametypes-1);
@ -11095,38 +10954,30 @@ CLEAN_DIRECTORY:
} }
playerswhenstarted = ud.multimode; playerswhenstarted = ud.multimode;
ud.last_level = -1; ud.last_level = 0;
if (Bstrcasecmp(ud.rtsname,"DUKE.RTS") == 0 || if (!Bstrcasecmp(ud.rtsname,"DUKE.RTS") ||
Bstrcasecmp(ud.rtsname,"WW2GI.RTS") == 0 || !Bstrcasecmp(ud.rtsname,"WW2GI.RTS") ||
Bstrcasecmp(ud.rtsname,"NAM.RTS") == 0) !Bstrcasecmp(ud.rtsname,"NAM.RTS"))
{ {
// ud.last_level is used as a flag here to reset the string to DUKE.RTS after load // ud.last_level is used as a flag here to reset the string to DUKE.RTS after load
if (WW2GI) if (WW2GI)
{ ud.last_level = (int32_t)Bstrcpy(ud.rtsname, "WW2GI.RTS");
ud.last_level = 1;
Bstrcpy(ud.rtsname, "WW2GI.RTS");
}
else if (NAM) else if (NAM)
{ ud.last_level = (int32_t)Bstrcpy(ud.rtsname, "NAM.RTS");
ud.last_level = 1;
Bstrcpy(ud.rtsname, "NAM.RTS");
}
else else
{ ud.last_level = (int32_t)Bstrcpy(ud.rtsname, "DUKE.RTS");
ud.last_level = 1;
Bstrcpy(ud.rtsname, "DUKE.RTS");
}
} }
RTS_Init(ud.rtsname); RTS_Init(ud.rtsname);
if (numlumps) initprintf("Using .RTS file '%s'\n",ud.rtsname);
if (ud.last_level == 1) if (numlumps)
{ initprintf("Using .RTS file '%s'\n",ud.rtsname);
ud.last_level = -1;
if (ud.last_level)
Bstrcpy(ud.rtsname, "DUKE.RTS"); Bstrcpy(ud.rtsname, "DUKE.RTS");
}
ud.last_level = -1;
initprintf("Initializing OSD...\n"); initprintf("Initializing OSD...\n");
@ -11151,12 +11002,6 @@ CLEAN_DIRECTORY:
for (i=0; i<joynumaxes; i++) for (i=0; i<joynumaxes; i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]); setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
/* if (VOLUMEONE)
{
if (numplayers > 4 || ud.multimode > 4)
G_GameExit(" The full version of Duke Nukem 3D supports 5 or more players.");
} */
{ {
char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,"."); char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,".");
Bsprintf(tempbuf,"%s_binds.cfg",p); Bsprintf(tempbuf,"%s_binds.cfg",p);
@ -11255,6 +11100,14 @@ MAIN_LOOP_RESTART:
if (G_EnterLevel(MODE_GAME)) G_BackToMenu(); if (G_EnterLevel(MODE_GAME)) G_BackToMenu();
} }
else G_DisplayLogo(); else G_DisplayLogo();
if (G_PlaybackDemo())
{
FX_StopAllSounds();
S_ClearSoundLocks();
g_noLogoAnim = 1;
goto MAIN_LOOP_RESTART;
}
} }
else if (ud.warp_on == 1) else if (ud.warp_on == 1)
{ {
@ -11264,14 +11117,6 @@ MAIN_LOOP_RESTART:
} }
else G_UpdateScreenArea(); else G_UpdateScreenArea();
if (ud.warp_on == 0 && G_PlaybackDemo())
{
FX_StopAllSounds();
S_ClearSoundLocks();
g_noLogoAnim = 1;
goto MAIN_LOOP_RESTART;
}
ud.auto_run = ud.config.RunMode; ud.auto_run = ud.config.RunMode;
ud.showweapons = ud.config.ShowOpponentWeapons; ud.showweapons = ud.config.ShowOpponentWeapons;
g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; g_player[myconnectindex].ps->aim_mode = ud.mouseaiming;
@ -11721,7 +11566,7 @@ RECHECK:
G_HandleLocalKeys(); G_HandleLocalKeys();
// j = min(max((totalclock-lockclock)*(65536/TICSPERFRAME),0),65536); // j = min(max((totalclock-lockclock)*(65536/TICSPERFRAME),0),65536);
j = min(max((totalclock - ototalclock) * (65536 / TICSPERFRAME),0),65536); j = min(max((totalclock - ototalclock) * (65536 / 4),0),65536);
G_DrawRooms(screenpeek,j); G_DrawRooms(screenpeek,j);
G_DisplayRest(j); G_DisplayRest(j);
@ -11846,17 +11691,13 @@ static void Net_CorrectPrediction(void)
p = g_player[myconnectindex].ps; p = g_player[myconnectindex].ps;
if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i] if (p->posx == myxbak[i] && p->posy == myybak[i] && p->posz == myzbak[i]
&& p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return; && p->horiz == myhorizbak[i] && p->ang == myangbak[i])
return;
Bmemcpy(&my, p, sizeof(vec3_t));
Bmemcpy(&omy, &p->oposx, sizeof(vec3_t));
Bmemcpy(&myvel, &p->posxv, sizeof(vec3_t));
my.x = p->posx;
omy.x = p->oposx;
myvel.x = p->posxv;
my.y = p->posy;
omy.y = p->oposy;
myvel.y = p->posyv;
my.z = p->posz;
omy.z = p->oposz;
myvel.z = p->poszv;
myang = p->ang; myang = p->ang;
omyang = p->oang; omyang = p->oang;
mycursectnum = p->cursectnum; mycursectnum = p->cursectnum;

View file

@ -3963,7 +3963,11 @@ static int32_t C_ParseCommand(void)
*g_scriptPtr++=i; *g_scriptPtr++=i;
} }
else else
{
g_numCompilerErrors++;
C_ReportError(ERROR_NOTAGAMEARRAY); C_ReportError(ERROR_NOTAGAMEARRAY);
return 1;
}
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
return 0; return 0;
case CON_COPY: case CON_COPY:
@ -3975,9 +3979,14 @@ static int32_t C_ParseCommand(void)
*g_scriptPtr++=i; *g_scriptPtr++=i;
} }
else else
{
g_numCompilerErrors++;
C_ReportError(ERROR_NOTAGAMEARRAY); C_ReportError(ERROR_NOTAGAMEARRAY);
return 1;
}
C_SkipComments();// skip comments and whitespace C_SkipComments();// skip comments and whitespace
if (*textptr != '[') if (*textptr != '[')
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(ERROR_GAMEARRAYBNO); C_ReportError(ERROR_GAMEARRAYBNO);
@ -4002,7 +4011,12 @@ static int32_t C_ParseCommand(void)
*g_scriptPtr++=i; *g_scriptPtr++=i;
} }
else else
{
g_numCompilerErrors++;
C_ReportError(ERROR_NOTAGAMEARRAY); C_ReportError(ERROR_NOTAGAMEARRAY);
return 1;
}
C_SkipComments();// skip comments and whitespace C_SkipComments();// skip comments and whitespace
if (*textptr != '[') if (*textptr != '[')
{ {
@ -4032,7 +4046,11 @@ static int32_t C_ParseCommand(void)
*g_scriptPtr++=i; *g_scriptPtr++=i;
} }
else else
{
g_numCompilerErrors++;
C_ReportError(ERROR_NOTAGAMEARRAY); C_ReportError(ERROR_NOTAGAMEARRAY);
return 1;
}
C_SkipComments(); C_SkipComments();
C_GetNextVar(); C_GetNextVar();
return 0; return 0;

View file

@ -333,7 +333,7 @@ void A_Fall(int32_t iActor)
c = g_spriteGravity/6; c = g_spriteGravity/6;
} }
if ((s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE)) if (s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE)
{ {
int32_t cstat = s->cstat; int32_t cstat = s->cstat;
s->cstat = 0; s->cstat = 0;
@ -2251,7 +2251,7 @@ nullquote:
int32_t y1=scale(Gv_GetVarX(*insptr++),ydim,200); int32_t y1=scale(Gv_GetVarX(*insptr++),ydim,200);
int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320); int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320);
int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200); int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200);
int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / TICSPERFRAME),0),65536); int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536);
#if defined(USE_OPENGL) && defined(POLYMOST) #if defined(USE_OPENGL) && defined(POLYMOST)
int32_t j; int32_t j;
#endif #endif
@ -4822,9 +4822,9 @@ void G_SaveMapState(mapstate_t *save)
Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect)); Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect));
Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect)); Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect));
Bmemcpy(&save->nextspritesect[0],&nextspritesect[0],sizeof(nextspritesect)); Bmemcpy(&save->nextspritesect[0],&nextspritesect[0],sizeof(nextspritesect));
Bmemcpy(&save->headspritestat[STAT_DEFAULT],&headspritestat[STAT_DEFAULT],sizeof(headspritestat)); Bmemcpy(&save->headspritestat[0],&headspritestat[0],sizeof(headspritestat));
Bmemcpy(&save->prevspritestat[STAT_DEFAULT],&prevspritestat[STAT_DEFAULT],sizeof(prevspritestat)); Bmemcpy(&save->prevspritestat[0],&prevspritestat[0],sizeof(prevspritestat));
Bmemcpy(&save->nextspritestat[STAT_DEFAULT],&nextspritestat[STAT_DEFAULT],sizeof(nextspritestat)); Bmemcpy(&save->nextspritestat[0],&nextspritestat[0],sizeof(nextspritestat));
for (i=MAXSPRITES-1; i>=0; i--) for (i=MAXSPRITES-1; i>=0; i--)
{ {
@ -4946,9 +4946,9 @@ void G_RestoreMapState(mapstate_t *save)
Bmemcpy(&headspritesect[0],&save->headspritesect[0],sizeof(headspritesect)); Bmemcpy(&headspritesect[0],&save->headspritesect[0],sizeof(headspritesect));
Bmemcpy(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect)); Bmemcpy(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect));
Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect)); Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect));
Bmemcpy(&headspritestat[STAT_DEFAULT],&save->headspritestat[STAT_DEFAULT],sizeof(headspritestat)); Bmemcpy(&headspritestat[0],&save->headspritestat[0],sizeof(headspritestat));
Bmemcpy(&prevspritestat[STAT_DEFAULT],&save->prevspritestat[STAT_DEFAULT],sizeof(prevspritestat)); Bmemcpy(&prevspritestat[0],&save->prevspritestat[0],sizeof(prevspritestat));
Bmemcpy(&nextspritestat[STAT_DEFAULT],&save->nextspritestat[STAT_DEFAULT],sizeof(nextspritestat)); Bmemcpy(&nextspritestat[0],&save->nextspritestat[0],sizeof(nextspritestat));
Bmemcpy(&ActorExtra[0],&save->ActorExtra[0],sizeof(ActorData_t)*MAXSPRITES); Bmemcpy(&ActorExtra[0],&save->ActorExtra[0],sizeof(ActorData_t)*MAXSPRITES);
for (i=MAXSPRITES-1; i>=0; i--) for (i=MAXSPRITES-1; i>=0; i--)

View file

@ -648,7 +648,7 @@ void M_DisplayMenus(void)
mgametext(160,104+8,"PLEASE READ THE 'HOW TO ORDER' ITEM",0,2+8+16); mgametext(160,104+8,"PLEASE READ THE 'HOW TO ORDER' ITEM",0,2+8+16);
mgametext(160,113+8,"ON THE MAIN MENU OR VISIT",0,2+8+16); mgametext(160,113+8,"ON THE MAIN MENU OR VISIT",0,2+8+16);
mgametext(160,122+8,"HTTP://WWW.BUY3DREALMS.COM",0,2+8+16); mgametext(160,122+8,"HTTP://WWW.EDUKE32.COM",0,2+8+16);
mgametext(160,131+8,"TO UPGRADE TO THE FULL REGISTERED",0,2+8+16); mgametext(160,131+8,"TO UPGRADE TO THE FULL REGISTERED",0,2+8+16);
mgametext(160,139+8,"VERSION OF DUKE NUKEM 3D.",0,2+8+16); mgametext(160,139+8,"VERSION OF DUKE NUKEM 3D.",0,2+8+16);
mgametext(160,148+16,"PRESS ANY KEY...",0,2+8+16); mgametext(160,148+16,"PRESS ANY KEY...",0,2+8+16);
@ -696,9 +696,6 @@ void M_DisplayMenus(void)
"Switch weapons when empty", "Switch weapons when empty",
"-", "-",
"-", "-",
"Net packets per second",
"-",
"-",
"Multiplayer macros", "Multiplayer macros",
NULL NULL
}; };
@ -825,14 +822,7 @@ void M_DisplayMenus(void)
G_UpdatePlayerFromMenu(); G_UpdatePlayerFromMenu();
} }
break; break;
#ifndef RANCID_NETWORKING
case 7: case 7:
if (x == io)
packetrate = min(max(((packetrate/50)*50)+50,50),1000);
modval(50,1000,(int32_t *)&packetrate,10,probey==7?2:0);
break;
#endif
case 8:
if (x == io) if (x == io)
{ {
ChangeToMenu(20004); ChangeToMenu(20004);

View file

@ -133,15 +133,15 @@ static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t
y1 += yv; y1 += yv;
z1 += zv; z1 += zv;
updatesector(x1,y1,&sect); updatesector(x1,y1,&sect);
if (sect >= 0) if (sect < 0)
{ break;
if (sector[sect].lotag == 2) if (sector[sect].lotag == 2)
A_InsertSprite(sect,x1,y1,z1,WATERBUBBLE,-32,4+(krand()&3),4+(krand()&3),krand()&2047,0,0,g_player[0].ps->i,5); A_InsertSprite(sect,x1,y1,z1,WATERBUBBLE,-32,4+(krand()&3),4+(krand()&3),krand()&2047,0,0,g_player[0].ps->i,5);
else else
A_InsertSprite(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps->i,5); A_InsertSprite(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps->i,5);
} }
} }
}
static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang, int32_t atwith) static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang, int32_t atwith)
{ {
@ -696,21 +696,27 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
if (j == -1) if (j == -1)
{ {
sa += (angRange/2)-(krand()&(angRange-1));
zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5;
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{
sa += (angRange/2)-(krand()&(angRange-1));
zvel += (zRange/2)-(krand()&(zRange-1)); zvel += (zRange/2)-(krand()&(zRange-1));
} }
} }
}
else else
{ {
sa += (angRange/2)-(krand()&(angRange-1));
if (j == -1) if (j == -1)
{ {
// no target // no target
zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5;
} }
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{
sa += (angRange/2)-(krand()&(angRange-1));
zvel += (zRange/2)-(krand()&(zRange-1)); zvel += (zRange/2)-(krand()&(zRange-1));
} }
}
srcvect.z -= (2<<8); srcvect.z -= (2<<8);
} }
else else
@ -722,14 +728,22 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
hitinfo.pos.x++; hitinfo.pos.x++;
zvel = ((g_player[j].ps->posz-srcvect.z) <<8) / hitinfo.pos.x; zvel = ((g_player[j].ps->posz-srcvect.z) <<8) / hitinfo.pos.x;
if (s->picnum != BOSS1) if (s->picnum != BOSS1)
{
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{ {
zvel += 128-(krand()&255); zvel += 128-(krand()&255);
sa += 32-(krand()&63); sa += 32-(krand()&63);
} }
}
else else
{
sa = getangle(g_player[j].ps->posx-srcvect.x,g_player[j].ps->posy-srcvect.y);
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{ {
zvel += 128-(krand()&255); zvel += 128-(krand()&255);
sa = getangle(g_player[j].ps->posx-srcvect.x,g_player[j].ps->posy-srcvect.y)+64-(krand()&127); sa += 64-(krand()&127);
}
} }
} }
@ -753,9 +767,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
return -1; return -1;
if (ProjectileData[atwith].trail >= 0) if (ProjectileData[atwith].trail >= 0)
{
A_HitscanProjTrail(&srcvect,&hitinfo.pos,sa,atwith); A_HitscanProjTrail(&srcvect,&hitinfo.pos,sa,atwith);
}
if (ProjectileData[atwith].workslike & PROJECTILE_WATERBUBBLES) if (ProjectileData[atwith].workslike & PROJECTILE_WATERBUBBLES)
{ {

View file

@ -1613,10 +1613,10 @@ void clearfifo(void)
void Net_ResetPrediction(void) void Net_ResetPrediction(void)
{ {
my.x = omy.x = g_player[myconnectindex].ps->posx; Bmemcpy(&my, &g_player[myconnectindex].ps, sizeof(vec3_t));
my.y = omy.y = g_player[myconnectindex].ps->posy; Bmemcpy(&omy, &g_player[myconnectindex].ps, sizeof(vec3_t));
my.z = omy.z = g_player[myconnectindex].ps->posz; Bmemset(&myvel, 0, sizeof(vec3_t));
myvel.x = myvel.y = myvel.z = 0;
myang = omyang = g_player[myconnectindex].ps->ang; myang = omyang = g_player[myconnectindex].ps->ang;
myhoriz = omyhoriz = g_player[myconnectindex].ps->horiz; myhoriz = omyhoriz = g_player[myconnectindex].ps->horiz;
myhorizoff = omyhorizoff = g_player[myconnectindex].ps->horizoff; myhorizoff = omyhorizoff = g_player[myconnectindex].ps->horizoff;

View file

@ -357,10 +357,7 @@ int32_t SetAnimation(int32_t animsect,int32_t *animptr, int32_t thegoal, int32_t
animatesect[j] = animsect; animatesect[j] = animsect;
animateptr[j] = animptr; animateptr[j] = animptr;
animategoal[j] = thegoal; animategoal[j] = thegoal;
if (thegoal >= *animptr) animatevel[j] = (thegoal >= *animptr) ? thevel : -thevel;
animatevel[j] = thevel;
else
animatevel[j] = -thevel;
if (j == g_animateCount) g_animateCount++; if (j == g_animateCount) g_animateCount++;
@ -375,13 +372,13 @@ void G_AnimateCamSprite(void)
if (camsprite <= 0) return; if (camsprite <= 0) return;
if (T1 >= 11) if (T1 >= 4)
{ {
T1 = 0; T1 = 0;
if (g_player[screenpeek].ps->newowner >= 0) if (g_player[screenpeek].ps->newowner >= 0)
OW = g_player[screenpeek].ps->newowner; OW = g_player[screenpeek].ps->newowner;
else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps->i],&sprite[i]) < 2048) else if (OW >= 0 && dist(&sprite[g_player[screenpeek].ps->i],&sprite[i]) < 8192)
{ {
if (waloff[TILE_VIEWSCR] == 0) if (waloff[TILE_VIEWSCR] == 0)
allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]);
@ -1008,6 +1005,7 @@ void G_OperateActivators(int32_t low,int32_t snum)
i = headspritestat[STAT_ACTIVATOR]; i = headspritestat[STAT_ACTIVATOR];
k = -1; k = -1;
while (i >= 0) while (i >= 0)
{ {
if (sprite[i].lotag == low) if (sprite[i].lotag == low)
@ -1129,13 +1127,15 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
if (switchtype == 1) // A wall sprite if (switchtype == 1) // A wall sprite
{ {
if (ActorExtra[w].lasttransport == totalclock) return 0;
ActorExtra[w].lasttransport = totalclock;
lotag = sprite[w].lotag; lotag = sprite[w].lotag;
if (lotag == 0) return 0; if (lotag == 0) return 0;
hitag = sprite[w].hitag; hitag = sprite[w].hitag;
// sx = sprite[w].x; // sx = sprite[w].x;
// sy = sprite[w].y; // sy = sprite[w].y;
Bmemcpy(&davector, &sprite[w], sizeof(int32_t) * 3); Bmemcpy(&davector, &sprite[w], sizeof(vec3_t));
picnum = sprite[w].picnum; picnum = sprite[w].picnum;
switchpal = sprite[w].pal; switchpal = sprite[w].pal;
} }
@ -2619,26 +2619,26 @@ CHECKINV1:
case 4: case 4:
if (p->jetpack_amount > 0 && i > 1) if (p->jetpack_amount > 0 && i > 1)
break; break;
if (k) dainv = 5; if (k) dainv++;
else dainv = 3; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 6: case 6:
if (p->scuba_amount > 0 && i > 1) if (p->scuba_amount > 0 && i > 1)
break; break;
if (k) dainv = 7; if (k) dainv++;
else dainv = 5; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 2: case 2:
if (p->steroids_amount > 0 && i > 1) if (p->steroids_amount > 0 && i > 1)
break; break;
if (k) dainv = 3; if (k) dainv++;
else dainv = 1; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 3: case 3:
if (p->holoduke_amount > 0 && i > 1) if (p->holoduke_amount > 0 && i > 1)
break; break;
if (k) dainv = 4; if (k) dainv++;
else dainv = 2; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 0: case 0:
case 1: case 1:
@ -2650,8 +2650,8 @@ CHECKINV1:
case 5: case 5:
if (p->heat_amount > 0 && i > 1) if (p->heat_amount > 0 && i > 1)
break; break;
if (k) dainv = 6; if (k) dainv++;
else dainv = 4; else dainv--;
goto CHECKINV1; goto CHECKINV1;
case 7: case 7:
if (p->boot_amount > 0 && i > 1) if (p->boot_amount > 0 && i > 1)
@ -2678,14 +2678,14 @@ CHECKINV1:
dainv=aGameVars[g_iReturnVarID].val.lValue; dainv=aGameVars[g_iReturnVarID].val.lValue;
} }
if (dainv > -1) if (dainv >= 1)
{ {
p->inven_icon = dainv; p->inven_icon = dainv;
if (dainv || p->firstaid_amount) if (dainv || p->firstaid_amount)
{ {
static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 }; static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 };
P_DoQuote(i[dainv], p); P_DoQuote(i[dainv-1], p);
} }
} }
} }
@ -3007,8 +3007,8 @@ int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
sintable[(SA+512)&2047], sintable[(SA+512)&2047],
sintable[SA&2047], sintable[SA&2047],
0,&hitinfo,CLIPMASK1); 0,&hitinfo,CLIPMASK1);
SZ += zoff; SZ += zoff;
*hitsp = hitinfo.hitsprite; *hitsp = hitinfo.hitsprite;
if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i])) if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i]))
return((1<<30)); return((1<<30));
@ -3226,13 +3226,13 @@ void P_CheckSectors(int32_t snum)
return; return;
case NUKEBUTTON__STATIC: case NUKEBUTTON__STATIC:
hitawall(p,&j); hitawall(p,&j);
if (j >= 0 && wall[j].overpicnum == 0) if (j >= 0 && wall[j].overpicnum == 0)
if (ActorExtra[neartagsprite].temp_data[0] == 0) if (ActorExtra[neartagsprite].temp_data[0] == 0)
{ {
if (ud.noexits && ud.multimode > 1) if (ud.noexits && ud.multimode > 1)
{ {
// NUKEBUTTON frags the player
ActorExtra[p->i].picnum = NUKEBUTTON; ActorExtra[p->i].picnum = NUKEBUTTON;
ActorExtra[p->i].extra = 250; ActorExtra[p->i].extra = 250;
} }
@ -3247,6 +3247,7 @@ void P_CheckSectors(int32_t snum)
} }
} }
return; return;
case WATERFOUNTAIN__STATIC: case WATERFOUNTAIN__STATIC:
if (ActorExtra[neartagsprite].temp_data[0] != 1) if (ActorExtra[neartagsprite].temp_data[0] != 1)
{ {
@ -3260,6 +3261,7 @@ void P_CheckSectors(int32_t snum)
} }
} }
return; return;
case PLUG__STATIC: case PLUG__STATIC:
A_PlaySound(SHORT_CIRCUIT,p->i); A_PlaySound(SHORT_CIRCUIT,p->i);
sprite[p->i].extra -= 2+(krand()&3); sprite[p->i].extra -= 2+(krand()&3);
@ -3268,6 +3270,7 @@ void P_CheckSectors(int32_t snum)
p->pals[2] = 64; p->pals[2] = 64;
p->pals_time = 32; p->pals_time = 32;
break; break;
case VIEWSCREEN__STATIC: case VIEWSCREEN__STATIC:
case VIEWSCREEN2__STATIC: case VIEWSCREEN2__STATIC:
{ {
@ -3301,9 +3304,7 @@ CLEARCAMERAS:
if (i < 0) if (i < 0)
{ {
p->posx = p->oposx; Bmemcpy(p, &p->oposx, sizeof(vec3_t));
p->posy = p->oposy;
p->posz = p->oposz;
p->ang = p->oang; p->ang = p->oang;
p->newowner = -1; p->newowner = -1;

View file

@ -652,12 +652,20 @@ int32_t A_PlaySound(uint32_t num, int32_t i)
void S_StopSound(int32_t num) void S_StopSound(int32_t num)
{ {
if (num >= 0 && num < MAXSOUNDS && g_sounds[num].num > 0) if (num >= 0 && num < MAXSOUNDS)
{ {
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice); if (g_sounds[num].num > 0)
{
int32_t j=g_sounds[num].num-1;
for (; j>=0; j--)
{
FX_StopSound(g_sounds[num].SoundOwner[j].voice);
// S_TestSoundCallback(num); // S_TestSoundCallback(num);
} }
} }
}
}
void S_StopEnvSound(int32_t num,int32_t i) void S_StopEnvSound(int32_t num,int32_t i)
{ {
@ -673,7 +681,6 @@ void S_StopEnvSound(int32_t num,int32_t i)
{ {
FX_StopSound(g_sounds[num].SoundOwner[j].voice); FX_StopSound(g_sounds[num].SoundOwner[j].voice);
// S_TestSoundCallback(num); // S_TestSoundCallback(num);
return;
} }
} }
} }
@ -772,12 +779,8 @@ void S_Pan3D(void)
void S_TestSoundCallback(uint32_t num) void S_TestSoundCallback(uint32_t num)
{ {
int32_t tempi,tempj,tempk;
if ((int32_t)num == MUSIC_ID) if ((int32_t)num == MUSIC_ID)
{
return; return;
}
if ((int32_t)num < 0) if ((int32_t)num < 0)
{ {
@ -786,30 +789,25 @@ void S_TestSoundCallback(uint32_t num)
return; return;
} }
tempk = g_sounds[num].num; {
int32_t j = 0;
if (tempk > 0) while (j < g_sounds[num].num)
{ {
if ((g_sounds[num].m&16) == 0) if (!FX_SoundActive(g_sounds[num].SoundOwner[j].voice))
for (tempj=0; tempj<tempk; tempj++)
{ {
tempi = g_sounds[num].SoundOwner[tempj].i; int32_t i = g_sounds[num].SoundOwner[j].i;
if (sprite[tempi].picnum == MUSICANDSFX && sector[sprite[tempi].sectnum].lotag < 3 && sprite[tempi].lotag < 999)
{
ActorExtra[tempi].temp_data[0] = 0;
if ((tempj + 1) < tempk)
{
g_sounds[num].SoundOwner[tempj].voice = g_sounds[num].SoundOwner[tempk-1].voice;
g_sounds[num].SoundOwner[tempj].i = g_sounds[num].SoundOwner[tempk-1].i;
}
break;
}
}
g_sounds[num].num--; g_sounds[num].num--;
g_sounds[num].SoundOwner[tempk-1].i = -1; // OSD_Printf("removing sound %d from spr %d\n",num,i);
if (sprite[i].picnum == MUSICANDSFX && sector[sprite[i].sectnum].lotag < 3 && sprite[i].lotag < 999)
ActorExtra[i].temp_data[0] = 0;
Bmemmove(&g_sounds[num].SoundOwner[j], &g_sounds[num].SoundOwner[j+1], sizeof(SOUNDOWNER) * (SOUNDMAX-j-1));
break;
}
j++;
}
} }
g_soundlocks[num]--; g_soundlocks[num]--;
} }