diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 073f0950a..d0eef1ec2 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -122,7 +122,7 @@ EDITOROBJS=$(OBJ)\astub.$o \ $(CC) /c $(CFLAGS) /Fo$@ $< {$(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 diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 9c8110daa..51118fdaf 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -36,7 +36,6 @@ #endif #define REPLACE_SYSTEM_ALLOCATOR -#define THREADCACHEMAX 65536 #include "nedmalloc.h" #ifndef TRUE diff --git a/polymer/eduke32/build/include/nedmalloc.h b/polymer/eduke32/build/include/nedmalloc.h index 5666150fa..756188901 100644 --- a/polymer/eduke32/build/include/nedmalloc.h +++ b/polymer/eduke32/build/include/nedmalloc.h @@ -29,6 +29,9 @@ DEALINGS IN THE SOFTWARE. #ifndef NEDMALLOC_H #define NEDMALLOC_H +#define THREADCACHEMAX 65536 +#define THREADCACHEMAXFREESPACE (1024*1024*4) + /* See malloc.c.h for what each function does. REPLACE_SYSTEM_ALLOCATOR causes nedalloc's functions to be called malloc, diff --git a/polymer/eduke32/build/include/polymer.h b/polymer/eduke32/build/include/polymer.h index b735d310b..a20f96310 100644 --- a/polymer/eduke32/build/include/polymer.h +++ b/polymer/eduke32/build/include/polymer.h @@ -289,7 +289,7 @@ typedef struct s_pranimatespritesinfo { } _pranimatespritesinfo; // MEMORY POOL -#define POLYMER_POOL_SIZE 65572864 +#define POLYMER_POOL_SIZE 33554432 extern nedpool* polymer_pool; // EXTERNAL FUNCTIONS diff --git a/polymer/eduke32/build/include/polymost.h b/polymer/eduke32/build/include/polymost.h index 48f2854e8..702ec2bc4 100644 --- a/polymer/eduke32/build/include/polymost.h +++ b/polymer/eduke32/build/include/polymost.h @@ -9,8 +9,6 @@ #define CULL_DELAY 2 #define MAXCULLCHECKS 1024 -#define FOGSCALE 0.0000640 - extern int32_t lastcullcheck; extern char cullmodel[MAXSPRITES]; extern int32_t cullcheckcnt; @@ -125,19 +123,20 @@ extern double gyxscale, gxyaspect, gviewxrange, ghalfx, grhalfxdown10, grhalfxdo extern double gcosang, gsinang, gcosang2, gsinang2; extern double gchang, gshang, gctang, gstang, gvisibility; +#define FOGSCALE 0.0000768 + extern float fogresult, fogcol[4], fogtable[4*MAXPALOOKUPS]; 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)))); 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)); } diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index 17e6c4428..81b2896a5 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -1818,8 +1818,7 @@ static int32_t kgifrend(const char *kfilebuf, int32_t kfilelength, coltype = 3; bitdepth = 8; //For PNGOUT - if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || - (kfilebuf[2] != 'F') || (kfilebuf[12])) return(-1); + if ((kfilebuf[0] != 'G') || (kfilebuf[1] != 'I') || (kfilebuf[2] != 'F')) return(-1); paleng = (1<<((kfilebuf[10]&7)+1)); ptr = (uint8_t *)&kfilebuf[13]; 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]; } } - 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]); (*ysiz) = (int32_t)SSWAPIB(*(uint16_t *)&buf[8]); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 539db94c2..8f44dba9d 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -648,7 +648,7 @@ void polymost_glinit() bglHint(GL_FOG_HINT,GL_DONT_CARE); } - bglFogi(GL_FOG_MODE,GL_EXP2); + bglFogi(GL_FOG_MODE, GL_EXP2); bglFogf(GL_FOG_DENSITY,1.0); //must be > 0, default is 1 /* bglFogf(GL_FOG_START,0.0); //default is 0 bglFogf(GL_FOG_END,1.0); //default is 1 */ diff --git a/polymer/eduke32/build/src/util/generateicon.c b/polymer/eduke32/build/src/util/generateicon.c index dce95d047..3356dc381 100644 --- a/polymer/eduke32/build/src/util/generateicon.c +++ b/polymer/eduke32/build/src/util/generateicon.c @@ -1,3 +1,4 @@ +#include "inttypes.h" #include "kplib.h" #include "compat.h" diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 5c8d4b2d6..236445fa2 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -817,7 +817,7 @@ int32_t initinput(void) if (Bstrcmp(layoutname, "00000409")) { 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); initprintf("to %s\n",layoutname); } diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 8d4972352..89ed4156c 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -286,104 +286,116 @@ BOLT: int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) { - int32_t oldx, oldy; - int32_t retval; + spritetype *spr = &sprite[spritenum]; + int32_t retval, daz; int16_t dasectnum, cd; - int32_t bg = A_CheckEnemySprite(&sprite[spritenum]); - int32_t daz; + int32_t bg = A_CheckEnemySprite(spr); + 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; - sprite[spritenum].y += (change->y*TICSPERFRAME)>>2; - sprite[spritenum].z += (change->z*TICSPERFRAME)>>2; + spr->x += (change->x*TICSPERFRAME)>>2; + spr->y += (change->y*TICSPERFRAME)>>2; + spr->z += (change->z*TICSPERFRAME)>>2; if (bg) - setsprite(spritenum,(vec3_t *)&sprite[spritenum]); + setsprite(spritenum,(vec3_t *)spr); 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) { - oldx = sprite[spritenum].x; - oldy = sprite[spritenum].y; - - if (sprite[spritenum].xrepeat > 60) + if (spr->xrepeat > 60) { - int32_t oz = sprite[spritenum].z; - sprite[spritenum].z = daz; - retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); - daz = sprite[spritenum].z; - sprite[spritenum].z = oz; + int32_t oz = spr->z; + spr->z = daz; + retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); + daz = spr->z; + spr->z = oz; } else { - int32_t oz = sprite[spritenum].z; + int32_t oz = spr->z; - if (sprite[spritenum].picnum == LIZMAN) + if (spr->picnum == LIZMAN) cd = 292L; - else if ((ActorType[sprite[spritenum].picnum]&3)) - cd = sprite[spritenum].clipdist<<2; + else if ((ActorType[spr->picnum]&3)) + cd = spr->clipdist<<2; else cd = 192L; - sprite[spritenum].z = daz; - retval = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); - daz = sprite[spritenum].z; - sprite[spritenum].z = oz; + spr->z = daz; + retval = clipmove((vec3_t *)spr,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); + daz = spr->z; + spr->z = oz; } if (dasectnum < 0 || (dasectnum >= 0 && ((ActorExtra[spritenum].actorstayput >= 0 && ActorExtra[spritenum].actorstayput != dasectnum) || - ((sprite[spritenum].picnum == BOSS2) && sprite[spritenum].pal == 0 && sector[dasectnum].lotag != 3) || - ((sprite[spritenum].picnum == BOSS1 || sprite[spritenum].picnum == BOSS2) && sector[dasectnum].lotag == 1) /*|| - (sector[dasectnum].lotag == 1 && (sprite[spritenum].picnum == LIZMAN || (sprite[spritenum].picnum == LIZTROOP && sprite[spritenum].zvel == 0)))*/ + ((spr->picnum == BOSS2) && spr->pal == 0 && sector[dasectnum].lotag != 3) || + ((spr->picnum == BOSS1 || spr->picnum == BOSS2) && sector[dasectnum].lotag == 1) /*|| + (sector[dasectnum].lotag == 1 && (spr->picnum == LIZMAN || (spr->picnum == LIZTROOP && spr->zvel == 0)))*/ )) ) { - sprite[spritenum].x = oldx; - sprite[spritenum].y = oldy; + spr->x = oldx; + spr->y = oldy; /* - if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN) - sprite[spritenum].ang = (krand()&2047); - else if ((ActorExtra[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER) - sprite[spritenum].ang = (krand()&2047); + if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && spr->picnum == LIZMAN) + spr->ang = (krand()&2047); + else if ((ActorExtra[spritenum].temp_data[0]&3) == 1 && spr->picnum != COMMANDER) + spr->ang = (krand()&2047); */ - setsprite(spritenum,(vec3_t *)&sprite[spritenum]); + setsprite(spritenum,(vec3_t *)spr); if (dasectnum < 0) dasectnum = 0; 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 { - int32_t oz = sprite[spritenum].z; - sprite[spritenum].z = daz; + int32_t oz = spr->z; + 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 = clipmove((vec3_t *)&sprite[spritenum],&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); else 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); - daz = sprite[spritenum].z; - sprite[spritenum].z = oz; - + 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 = spr->z; + spr->z = oz; } - if (dasectnum >= 0) - if ((dasectnum != sprite[spritenum].sectnum)) - changespritesect(spritenum,dasectnum); - daz = sprite[spritenum].z + ((change->z*TICSPERFRAME)>>3); - if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)) - sprite[spritenum].z = daz; + if (dasectnum == -1) + { + dasectnum = spr->sectnum; + /*OSD_Printf("%s:%d wtf\n",__FILE__,__LINE__);*/ + } + + if ((dasectnum != spr->sectnum)) + { + changespritesect(spritenum,dasectnum); + A_GetZLimits(spritenum); + } + + 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; if (retval == (16384+dasectnum)) - if (sprite[spritenum].statnum == STAT_PROJECTILE) + if (spr->statnum == STAT_PROJECTILE) { 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); - sprite[spritenum].x += (sprite[OW].x-SX); - sprite[spritenum].y += (sprite[OW].y-SY); - sprite[spritenum].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; + spr->x += (sprite[OW].x-SX); + spr->y += (sprite[OW].y-SY); + spr->z = sector[sprite[OW].sectnum].ceilingz - daz + sector[sprite[i].sectnum].floorz; + Bmemcpy(&ActorExtra[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t)); 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) { ActorExtra[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); - sprite[spritenum].x += (sprite[OW].x-SX); - sprite[spritenum].y += (sprite[OW].y-SY); - sprite[spritenum].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; + spr->x += (sprite[OW].x-SX); + spr->y += (sprite[OW].y-SY); + spr->z = sector[sprite[OW].sectnum].floorz - daz + sector[sprite[i].sectnum].ceilingz; + Bmemcpy(&ActorExtra[spritenum].bposx, &sprite[spritenum], sizeof(vec3_t)); 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); } -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; - - davect.x = (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14; - davect.y = (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14; - davect.z = sprite[i].zvel; + vec3_t davect = { (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, + (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, + sprite[i].zvel }; return (A_MoveSprite(i,&davect,cliptype)==0); } -#undef deletesprite - int32_t block_deletesprite = 0; +// all calls to deletesprite() from the game are wrapped by this function void A_DeleteSprite(int32_t s) { if (block_deletesprite) @@ -479,9 +482,10 @@ void A_DeleteSprite(int32_t s) } #endif +#undef deletesprite deletesprite(s); -} #define deletesprite A_DeleteSprite +} void A_AddToDeleteQueue(int32_t i) { @@ -1002,7 +1006,7 @@ BOLT: int32_t otherp; -static void G_MovePlayers(void) //Players +static void G_MovePlayers(void) { int32_t i = headspritestat[STAT_PLAYER], nexti; int32_t otherx; @@ -1091,10 +1095,7 @@ static void G_MovePlayers(void) //Players if (p->holoduke_on == -1) KILLIT(i); - ActorExtra[i].bposx = s->x; - ActorExtra[i].bposy = s->y; - ActorExtra[i].bposz = s->z; - + Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t)); s->cstat = 0; if (s->xrepeat < 42) @@ -1354,9 +1355,7 @@ static void G_MoveStandables(void) if (sect < 0) KILLIT(i); - ActorExtra[i].bposx = s->x; - ActorExtra[i].bposy = s->y; - ActorExtra[i].bposz = s->z; + Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t)); IFWITHIN(CRANE,CRANE+3) { @@ -1530,9 +1529,7 @@ static void G_MoveStandables(void) { setsprite(s->owner,(vec3_t *)s); - ActorExtra[s->owner].bposx = s->x; - ActorExtra[s->owner].bposy = s->y; - ActorExtra[s->owner].bposz = s->z; + Bmemcpy(&ActorExtra[s->owner].bposx, s, sizeof(vec3_t)); s->zvel = 0; } @@ -2353,9 +2350,7 @@ static void G_MoveWeapons(void) if (s->sectnum < 0) KILLIT(i); - ActorExtra[i].bposx = s->x; - ActorExtra[i].bposy = s->y; - ActorExtra[i].bposz = s->z; + Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t)); // here 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].ang = sprite[OW].ang; - ActorExtra[j].bposx = sprite[j].x; - ActorExtra[j].bposy = sprite[j].y; - ActorExtra[j].bposz = sprite[j].z; + Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t)); if (sprite[i].pal == 0) { @@ -3382,9 +3375,7 @@ static void G_MoveTransports(void) sprite[j].y += (sprite[OW].y-SY); sprite[j].z = sprite[OW].z+4096; - ActorExtra[j].bposx = sprite[j].x; - ActorExtra[j].bposy = sprite[j].y; - ActorExtra[j].bposz = sprite[j].z; + Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t)); changespritesect(j,sprite[OW].sectnum); } @@ -3396,9 +3387,8 @@ static void G_MoveTransports(void) sprite[j].y += (sprite[OW].y-SY); sprite[j].z = sector[sprite[OW].sectnum].ceilingz; - ActorExtra[j].bposx = sprite[j].x; - ActorExtra[j].bposy = sprite[j].y; - ActorExtra[j].bposz = sprite[j].z; + + Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t)); changespritesect(j,sprite[OW].sectnum); @@ -3409,9 +3399,7 @@ static void G_MoveTransports(void) sprite[j].y += (sprite[OW].y-SY); sprite[j].z = sector[sprite[OW].sectnum].floorz; - ActorExtra[j].bposx = sprite[j].x; - ActorExtra[j].bposy = sprite[j].y; - ActorExtra[j].bposz = sprite[j].z; + Bmemcpy(&ActorExtra[j].bposx, &sprite[j], sizeof(vec3_t)); changespritesect(j,sprite[OW].sectnum); @@ -3466,9 +3454,8 @@ static void G_MoveActors(void) t = &ActorExtra[i].temp_data[0]; - ActorExtra[i].bposx = s->x; - ActorExtra[i].bposy = s->y; - ActorExtra[i].bposz = s->z; + Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t)); + switchpicnum=s->picnum; 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); - ActorExtra[i].bposx = s->x; - ActorExtra[i].bposy = s->y; - ActorExtra[i].bposz = s->z; + Bmemcpy(&ActorExtra[i].bposx, s, sizeof(vec3_t)); + switchpicnum = s->picnum; 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- (sc->floorz-sprite[k].z); - ActorExtra[k].bposx = sprite[k].x; - ActorExtra[k].bposy = sprite[k].y; - ActorExtra[k].bposz = sprite[k].z; + Bmemcpy(&ActorExtra[k].bposx, &sprite[k], sizeof(vec3_t)); changespritesect(k,sprite[j].sectnum); setsprite(k,(vec3_t *)&sprite[k]); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 8c0d2ca96..82d7bc039 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -972,6 +972,7 @@ enum ProjectileFlags_t { PROJECTILE_ACCURATE_AUTOAIM = 131072, PROJECTILE_FORCEIMPACT = 262144, PROJECTILE_REALCLIPDIST = 524288, + PROJECTILE_ACCURATE = 1048576, }; extern projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES]; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9799d04cd..680a57d15 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -890,6 +890,7 @@ void Net_GetPackets(void) for (; i-j<10; i++) g_player[other].wchoice[i-j] = packbuf[i]; break; + case PACKET_RTS: //slaves in M/S mode only send to master //Master re-transmits message to all others @@ -904,6 +905,7 @@ void Net_GetPackets(void) rtsptr = (char *)RTS_GetSound(packbuf[1]-1); FX_PlayAuto3D(rtsptr,RTS_SoundLength(packbuf[1]-1),0,0,0,255,-packbuf[1]); g_RTSPlaying = 7; + break; case PACKET_MENU_LEVEL_QUIT: @@ -1406,12 +1408,7 @@ void faketimerhandler(void) } extern int32_t cacnum; -typedef struct -{ - int32_t *hand, leng; - char *lock ; -} -cactype; +typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype; extern cactype cac[]; 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),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) { @@ -3411,11 +3412,10 @@ void G_GetCrosshairColor(void) ptr++; ii--; } - while (ii > 0); + while (ii); - DefaultCrosshairColors.r = CrosshairColors.r = curpalette[bri].r; - DefaultCrosshairColors.g = CrosshairColors.g = curpalette[bri].g; - DefaultCrosshairColors.b = CrosshairColors.b = curpalette[bri].b; + Bmemcpy(&CrosshairColors, &curpalette[bri], sizeof(palette_t)); + Bmemcpy(&DefaultCrosshairColors, &curpalette[bri], sizeof(palette_t)); DefaultCrosshairColors.f = 1; // this flag signifies that the color has been detected } } @@ -3431,7 +3431,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) CrosshairColors.r = r; CrosshairColors.g = g; CrosshairColors.b = b; - + if (waloff[CROSSHAIR] == 0) { loadtile(CROSSHAIR); @@ -3452,7 +3452,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b) ptr++; ii--; } - while (ii > 0); + while (ii); for (i = 255; i >= 0; 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); #if defined(USE_OPENGL) && defined(POLYMOST) - hictinting[CROSSHAIR_PAL].r = CrosshairColors.r; - hictinting[CROSSHAIR_PAL].g = CrosshairColors.g; - hictinting[CROSSHAIR_PAL].b = CrosshairColors.b; + Bmemcpy(&hictinting[CROSSHAIR_PAL], &CrosshairColors, sizeof(palette_t)); hictinting[CROSSHAIR_PAL].f = 9; #endif 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) { 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); if (getrendermode() >= 3) pus = pub = NUMPAGES; // JBF 20040110: redraw the status bar next time if ((e&128) == 0) @@ -3508,45 +3494,36 @@ void G_DisplayRest(int32_t smoothratio) // this takes care of fullscreen tint for OpenGL 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 (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; - hictinting[MAXPALOOKUPS-1].g = 192; - hictinting[MAXPALOOKUPS-1].b = 255; + static palette_t wp = { 224, 192, 255, 0 }; + Bmemcpy(&hictinting[MAXPALOOKUPS-1], &wp, sizeof(palette_t)); } - 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) { - if (hictinting[MAXPALOOKUPS-3].r == 255 && hictinting[MAXPALOOKUPS-3].g == 255 && hictinting[MAXPALOOKUPS-3].b == 255) - { - hictinting[MAXPALOOKUPS-1].r = 208; - hictinting[MAXPALOOKUPS-1].g = 255; - hictinting[MAXPALOOKUPS-1].b = 192; - } - else Bmemcpy(&hictinting[MAXPALOOKUPS-1],&hictinting[MAXPALOOKUPS-3],sizeof(hictinting[0])); +// if ((*(uint32_t *)&hictinting[MAXPALOOKUPS-3].r)|0x000000FF) == 0xFFFFFFFF) + { + static palette_t sp = { 208, 255, 192, 0 }; + Bmemcpy(&hictinting[MAXPALOOKUPS-1], &sp, sizeof(palette_t)); + } + +// else Bmemcpy(&hictinting[MAXPALOOKUPS-1], &hictinting[MAXPALOOKUPS-3], sizeof(palette_t)); } else { - hictinting[MAXPALOOKUPS-1].r = 255; - hictinting[MAXPALOOKUPS-1].g = 255; - hictinting[MAXPALOOKUPS-1].b = 255; + *(uint32_t *)&hictinting[MAXPALOOKUPS-1].r = 0xFFFFFFFF; } -#endif } #endif /* USE_OPENGL && POLYMOST */ // this does pain tinting etc from the CON if (pp->pals_time >= 0 && pp->loogcnt == 0) // JBF 20040101: pals_time > 0 now >= 0 { - tempFade.r = pp->pals[0]; - tempFade.g = pp->pals[1]; - tempFade.b = pp->pals[2]; +// tempFade = (palette_t) { pp->pals[0], pp->pals[1], pp->pals[2], pp->pals_time }; + Bmemcpy(&tempFade, &pp->pals, sizeof(palette_t)); tempFade.f = pp->pals_time; g_restorePalette = 1; // JBF 20040101 applyTint = 1; @@ -3562,19 +3539,12 @@ void G_DisplayRest(int32_t smoothratio) else if (pp->loogcnt > 0) { //G_FadePalette(0,64,0,(pp->loogcnt>>1)+128); - tempFade.r = 0; - tempFade.g = 64; - tempFade.b = 0; - tempFade.f = pp->loogcnt>>1; + palette_t lp = { 0, 64, 0, pp->loogcnt>>1 }; + Bmemcpy(&tempFade, &lp, sizeof(palette_t)); applyTint = 1; } if (tempFade.f > tempTint.f) - { - tempTint.r = tempFade.r; - tempTint.g = tempFade.g; - tempTint.b = tempFade.b; - tempTint.f = tempFade.f; - } + Bmemcpy(&tempTint, &tempFade, sizeof(palette_t)); if (ud.show_help) { @@ -3639,7 +3609,7 @@ void G_DisplayRest(int32_t smoothratio) if (ud.overhead_on > 0) { // 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); if (ud.scrollmode == 0) { @@ -3711,11 +3681,11 @@ void G_DisplayRest(int32_t smoothratio) { int32_t bits = 10+16; - if (g_levelTextTime > 4) - bits = bits; - else if (g_levelTextTime > 2) + if (g_levelTextTime < 3) + bits |= 1+32; + else if (g_levelTextTime < 5) bits |= 1; - else bits |= 1+32; + if (MapInfo[(ud.volume_number*MAXLEVELS) + ud.level_number].name != NULL) { 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 ny = (sintable[(ang+1024)&2047]>>4); int32_t nz = (horiz-100)*128; - int16_t daang; - int16_t bakcstat = sp->cstat; + int32_t daang; + int32_t bakcstat = sp->cstat; hitdata_t hitinfo; sp->cstat &= (int16_t)~0x101; @@ -4200,7 +4170,7 @@ void G_SE40(int32_t smoothratio) } } -void G_DrawRooms(int32_t snum,int32_t smoothratio) +void G_DrawRooms(int32_t snum, int32_t smoothratio) { int32_t dst,j,fz,cz; int32_t tposx,tposy,i; @@ -4220,7 +4190,7 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) return; // 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)); @@ -4323,18 +4293,22 @@ void G_DrawRooms(int32_t snum,int32_t smoothratio) if ((snum == myconnectindex) && (numplayers > 1)) { - ud.camera.x = omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio); - ud.camera.y = omy.y+mulscale16((int32_t)(my.y-omy.y),smoothratio); - ud.camera.z = omy.z+mulscale16((int32_t)(my.z-omy.z),smoothratio); + vec3_t cam = { omy.x+mulscale16((int32_t)(my.x-omy.x),smoothratio), + omy.y+mulscale16((int32_t)(my.y-omy.y),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.camerahoriz = omyhoriz+omyhorizoff+mulscale16((int32_t)(myhoriz+myhorizoff-omyhoriz-omyhorizoff),smoothratio); ud.camerasect = mycursectnum; } else { - ud.camera.x = p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio); - ud.camera.y = p->oposy+mulscale16((int32_t)(p->posy-p->oposy),smoothratio); - ud.camera.z = p->oposz+mulscale16((int32_t)(p->posz-p->oposz),smoothratio); + vec3_t cam = { p->oposx+mulscale16((int32_t)(p->posx-p->oposx),smoothratio), + p->oposy+mulscale16((int32_t)(p->posy-p->oposy),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.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.camerahoriz = p->horiz+p->horizoff; - ud.camera.x = p->posx; - ud.camera.y = p->posy; - ud.camera.z = p->posz; + Bmemcpy(&ud.camera, p, sizeof(vec3_t)); ud.camerasect = sprite[p->newowner].sectnum; 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 i = insertsprite(whatsect,s_ss); - int32_t p; + int32_t p, i = insertsprite(whatsect,s_ss); 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) { 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."); } + 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].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) { 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].lastvx = 0; - ActorExtra[i].lastvy = 0; - - ActorExtra[i].timetosleep = 0; - ActorExtra[i].actorstayput = -1; - ActorExtra[i].extra = -1; + ActorExtra[i].actorstayput = ActorExtra[i].extra = ActorExtra[i].lightId = -1; 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; @@ -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); 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)); else show2dsprite[i>>3] &= ~(1<<(i&7)); @@ -4667,23 +4598,15 @@ 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(&spritesmooth[i], sizeof(spritesmooth_t), 0); - /* - if(s->sectnum < 0) - { - s->xrepeat = s->yrepeat = 0; - changespritestat(i,5); - } - */ A_ResetVars(i); - ActorExtra[i].flags = 0; if (apScriptGameEvent[EVENT_EGS]) { extern int32_t block_deletesprite; - int32_t pl=A_FindPlayer(&sprite[i],&p); + int32_t pl=A_FindPlayer(s, &p); block_deletesprite++; - X_OnEvent(EVENT_EGS,i, pl, p); + X_OnEvent(EVENT_EGS, i, pl, p); block_deletesprite--; } @@ -4705,34 +4628,19 @@ int32_t A_Spawn(int32_t j, int32_t pn) else { i = pn; + + Bmemset(&ActorExtra[i], 0, sizeof(ActorData_t)); + Bmemcpy(&ActorExtra[i].bposx, &sprite[i], sizeof(vec3_t)); + ActorExtra[i].picnum = PN; - ActorExtra[i].timetosleep = 0; - ActorExtra[i].extra = -1; ActorExtra[i].projectile = &SpriteProjectile[i]; - ActorExtra[i].bposx = SX; - ActorExtra[i].bposy = SY; - ActorExtra[i].bposz = SZ; - 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].ceilingz = sector[SECT].ceilingz; - ActorExtra[i].lastvx = 0; - 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; + ActorExtra[i].actorstayput = ActorExtra[i].lightId = ActorExtra[i].extra = -1; // 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; changespritestat(i,5); - } else { @@ -4952,10 +4859,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) else { if (sprite[j].statnum == STAT_PROJECTILE) - { - sp->xrepeat = 8; - sp->yrepeat = 8; - } + sp->xrepeat = sp->yrepeat = 8; else { sp->xrepeat = 48; @@ -5130,8 +5034,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->xrepeat=4; sp->yrepeat=5; - sp->owner = i; - sp->hitag = i; + sp->owner = sp->hitag = i; sp->xvel = 16; A_SetSprite(i,CLIPMASK0); @@ -5409,8 +5312,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: sp->owner = i; - sp->lotag = 1; - sp->extra = 1; + sp->lotag = sp->extra = 1; changespritestat(i,6); break; @@ -5494,27 +5396,19 @@ int32_t A_Spawn(int32_t j, int32_t pn) if (sp->picnum == EXPLOSION2 || sp->picnum == EXPLOSION2BOT) { - sp->xrepeat = 48; - sp->yrepeat = 48; + sp->xrepeat = sp->yrepeat = 48; sp->shade = -127; sp->cstat |= 128; } else if (sp->picnum == SHRINKEREXPLOSION) - { - sp->xrepeat = 32; - sp->yrepeat = 32; - } + sp->xrepeat = sp->yrepeat = 32; else if (sp->picnum == SMALLSMOKE) { // 64 "money" - sp->xrepeat = 24; - sp->yrepeat = 24; + sp->xrepeat = sp->yrepeat = 24; } else if (sp->picnum == BURNING || sp->picnum == BURNING2) - { - sp->xrepeat = 4; - sp->yrepeat = 4; - } + sp->xrepeat = sp->yrepeat = 4; if (j >= 0) { @@ -5633,10 +5527,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->ang = krand()&2047; case WATERDRIPSPLASH__STATIC: - - sp->xrepeat = 24; - sp->yrepeat = 24; - + sp->xrepeat = sp->yrepeat = 24; changespritestat(i,6); break; @@ -5748,13 +5639,11 @@ int32_t A_Spawn(int32_t j, int32_t pn) if (sp->pal) { sp->clipdist = 80; - sp->xrepeat = 40; - sp->yrepeat = 40; + sp->xrepeat = sp->yrepeat = 40; } else { - sp->xrepeat = 80; - sp->yrepeat = 80; + sp->xrepeat = sp->yrepeat = 80; sp->clipdist = 164; } } @@ -5762,14 +5651,12 @@ int32_t A_Spawn(int32_t j, int32_t pn) { if (sp->picnum != SHARK) { - sp->xrepeat = 40; - sp->yrepeat = 40; + sp->xrepeat = sp->yrepeat = 40; sp->clipdist = 80; } else { - sp->xrepeat = 60; - sp->yrepeat = 60; + sp->xrepeat = sp->yrepeat = 60; sp->clipdist = 40; } } @@ -6502,7 +6389,6 @@ int32_t A_Spawn(int32_t j, int32_t pn) case SEENINE__STATIC: case OOZFILTER__STATIC: - sp->shade = -16; if (sp->xrepeat <= 8) { @@ -6553,6 +6439,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) sp->clipdist = 8; sp->owner = i; break; + case CANWITHSOMETHING__STATIC: case CANWITHSOMETHING2__STATIC: case CANWITHSOMETHING3__STATIC: @@ -6567,7 +6454,6 @@ int32_t A_Spawn(int32_t j, int32_t pn) case NUKEBARRELDENTED__STATIC: case NUKEBARRELLEAKED__STATIC: case WOODENHORSE__STATIC: - if (j >= 0) sp->xrepeat = sp->yrepeat = 32; sp->clipdist = 72; @@ -6589,6 +6475,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) changespritestat(i, STAT_ZOMBIEACTOR); } break; + case TOILETWATER__STATIC: sp->shade = -16; changespritestat(i,6); @@ -6605,7 +6492,7 @@ SPAWN_END: 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 // tell it not to try... such a pussy it is. //#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; */ tsprite[spritesortcnt].shade = t->shade; - tsprite[spritesortcnt].cstat = 0; - tsprite[spritesortcnt].pal = 0; + tsprite[spritesortcnt].cstat = tsprite[spritesortcnt].pal = 0; 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); if (tsprite[spritesortcnt].picnum == HEAVYHBOMB) - { - tsprite[spritesortcnt].xrepeat = 10; - tsprite[spritesortcnt].yrepeat = 10; - } + tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 10; else - { - tsprite[spritesortcnt].xrepeat = 16; - tsprite[spritesortcnt].yrepeat = 16; - } + tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 16; + 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].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].picnum = RESPAWNMARKERGREEN; if (s->owner >= 0) tsprite[spritesortcnt].z = g_player[p].ps->posz-(20<<8); - else tsprite[spritesortcnt].z = s->z-(96<<8); - tsprite[spritesortcnt].xrepeat = 32; - tsprite[spritesortcnt].yrepeat = 32; + else + tsprite[spritesortcnt].z = s->z-(96<<8); + + tsprite[spritesortcnt].xrepeat = tsprite[spritesortcnt].yrepeat = 32; tsprite[spritesortcnt].pal = 20; spritesortcnt++; } @@ -7539,7 +7420,7 @@ PALONLY: } } } -#ifdef _MSC_VER +#if 0 // def _MSC_VER //#pragma auto_inline() #pragma optimize("",on) #endif @@ -8243,7 +8124,7 @@ static void G_HandleLocalKeys(void) { tempbuf[0] = PACKET_MAP_VOTE; tempbuf[1] = myconnectindex; - tempbuf[2] = (KB_UnBoundKeyPressed(sc_F1) || ud.autovote?ud.autovote-1:0); + tempbuf[2] = (KB_UnBoundKeyPressed(sc_F1) || ud.autovote ? ud.autovote-1 : 0); TRAVERSE_CONNECT(i) { @@ -8956,7 +8837,7 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload) { "#include", T_INCLUDE }, { "loadgrp", T_LOADGRP }, { "cachesize", T_CACHESIZE }, - { "noautload", T_NOAUTOLOAD }, + { "noautoload", T_NOAUTOLOAD }, { "music", T_MUSIC }, { "sound", T_SOUND }, }; @@ -9199,12 +9080,9 @@ static void G_AddPath(const char *buffer) static void G_CheckCommandLine(int32_t argc, const char **argv) { - int16_t i, j; - char *c; int32_t firstnet = 0; - char *k; - - i = 1; + int16_t i = 1, j; + char *c, *k; ud.fta_on = 1; ud.god = 0; @@ -9478,15 +9356,13 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) if ((*c == '/') || (*c == '-')) { c++; - switch (*c) + switch (Btolower(*c)) { case 'a': - case 'A': ud.playerai = 1; initprintf("Other player AI.\n"); break; case 'c': - case 'C': c++; //if(*c == '1' || *c == '2' || *c == '3') @@ -9515,7 +9391,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) //} break; case 'd': - case 'D': c++; if (strchr(c,'.') == 0) Bstrcat(c,".dmo"); @@ -9523,7 +9398,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) Bstrcpy(firstdemofile,c); break; case 'f': - case 'F': c++; if (*c == '1') g_movesPerPacket = 1; @@ -9536,13 +9410,11 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) } break; case 'g': - case 'G': c++; if (!*c) break; G_AddGroup(c); break; case 'h': - case 'H': c++; if (*c) { @@ -9551,26 +9423,22 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) } break; case 'i': - case 'I': c++; if (*c == '0') g_networkBroadcastMode = 0; if (*c == '1') g_networkBroadcastMode = 1; initprintf("Network Mode %d\n",g_networkBroadcastMode); break; case 'j': - case 'J': c++; if (!*c) break; G_AddPath(c); break; case 'l': - case 'L': ud.warp_on = 1; c++; ud.m_level_number = ud.level_number = (atoi(c)-1)%MAXLEVELS; break; case 'm': - case 'M': if (*(c+1) != 'a' && *(c+1) != 'A') { ud.m_monsters_off = 1; @@ -9579,7 +9447,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) } break; case 'n': - case 'N': c++; if (*c == 's' || *c == 'S') { @@ -9608,7 +9475,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) } break; case 'q': - case 'Q': initprintf("Fake multiplayer mode.\n"); if (*(++c) == 0) ud.multimode = 1; 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; break; case 'r': - case 'R': ud.m_recstat = 1; initprintf("Demo record mode on.\n"); break; case 's': - case 'S': c++; ud.m_player_skill = ud.player_skill = (atoi(c)%5); if (ud.m_player_skill == 4) ud.m_respawn_monsters = ud.respawn_monsters = 1; break; case 't': - case 'T': c++; if (*c == '1') ud.m_respawn_monsters = 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"); break; case 'u': - case 'U': CommandWeaponChoice = 1; c++; j = 0; @@ -9684,17 +9546,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) } break; case 'v': - case 'V': c++; ud.warp_on = 1; ud.m_volume_number = ud.volume_number = atoi(c)-1; break; case 'w': - case 'W': ud.coords = 1; break; case 'x': - case 'X': c++; if (*c) { @@ -9716,7 +9575,6 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) ud.warp_on = 2 + (*c) - '0'; break; case 'z': - case 'Z': c++; g_scriptDebug = atoi(c); if (!g_scriptDebug) @@ -10023,7 +9881,8 @@ void G_Shutdown(void) static void G_CompileScripts(void) { 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 *)§or[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 @@ -10083,7 +9942,7 @@ static void G_CompileScripts(void) pathsearchmode = psm; } -static void G_CheckGametype(void) +static inline void G_CheckGametype(void) { // initprintf("ud.m_coop=%i before sanitization\n",ud.m_coop); ud.m_coop = clamp(ud.m_coop, 0, g_numGametypes-1); @@ -11095,38 +10954,30 @@ CLEAN_DIRECTORY: } playerswhenstarted = ud.multimode; - ud.last_level = -1; + ud.last_level = 0; - if (Bstrcasecmp(ud.rtsname,"DUKE.RTS") == 0 || - Bstrcasecmp(ud.rtsname,"WW2GI.RTS") == 0 || - Bstrcasecmp(ud.rtsname,"NAM.RTS") == 0) + if (!Bstrcasecmp(ud.rtsname,"DUKE.RTS") || + !Bstrcasecmp(ud.rtsname,"WW2GI.RTS") || + !Bstrcasecmp(ud.rtsname,"NAM.RTS")) { // ud.last_level is used as a flag here to reset the string to DUKE.RTS after load if (WW2GI) - { - ud.last_level = 1; - Bstrcpy(ud.rtsname, "WW2GI.RTS"); - } + ud.last_level = (int32_t)Bstrcpy(ud.rtsname, "WW2GI.RTS"); else if (NAM) - { - ud.last_level = 1; - Bstrcpy(ud.rtsname, "NAM.RTS"); - } + ud.last_level = (int32_t)Bstrcpy(ud.rtsname, "NAM.RTS"); else - { - ud.last_level = 1; - Bstrcpy(ud.rtsname, "DUKE.RTS"); - } + ud.last_level = (int32_t)Bstrcpy(ud.rtsname, "DUKE.RTS"); } RTS_Init(ud.rtsname); - if (numlumps) initprintf("Using .RTS file '%s'\n",ud.rtsname); - if (ud.last_level == 1) - { - ud.last_level = -1; + if (numlumps) + initprintf("Using .RTS file '%s'\n",ud.rtsname); + + if (ud.last_level) Bstrcpy(ud.rtsname, "DUKE.RTS"); - } + + ud.last_level = -1; initprintf("Initializing OSD...\n"); @@ -11151,12 +11002,6 @@ CLEAN_DIRECTORY: for (i=0; i 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,"."); Bsprintf(tempbuf,"%s_binds.cfg",p); @@ -11255,6 +11100,14 @@ MAIN_LOOP_RESTART: if (G_EnterLevel(MODE_GAME)) G_BackToMenu(); } else G_DisplayLogo(); + + if (G_PlaybackDemo()) + { + FX_StopAllSounds(); + S_ClearSoundLocks(); + g_noLogoAnim = 1; + goto MAIN_LOOP_RESTART; + } } else if (ud.warp_on == 1) { @@ -11264,14 +11117,6 @@ MAIN_LOOP_RESTART: } 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.showweapons = ud.config.ShowOpponentWeapons; g_player[myconnectindex].ps->aim_mode = ud.mouseaiming; @@ -11721,7 +11566,7 @@ RECHECK: G_HandleLocalKeys(); // 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_DisplayRest(j); @@ -11846,17 +11691,13 @@ static void Net_CorrectPrediction(void) p = g_player[myconnectindex].ps; 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; omyang = p->oang; mycursectnum = p->cursectnum; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 41375600c..fa2a3513e 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -3963,7 +3963,11 @@ static int32_t C_ParseCommand(void) *g_scriptPtr++=i; } else + { + g_numCompilerErrors++; C_ReportError(ERROR_NOTAGAMEARRAY); + return 1; + } C_GetNextValue(LABEL_DEFINE); return 0; case CON_COPY: @@ -3975,9 +3979,14 @@ static int32_t C_ParseCommand(void) *g_scriptPtr++=i; } else + { + g_numCompilerErrors++; C_ReportError(ERROR_NOTAGAMEARRAY); + return 1; + } C_SkipComments();// skip comments and whitespace if (*textptr != '[') + { g_numCompilerErrors++; C_ReportError(ERROR_GAMEARRAYBNO); @@ -4002,7 +4011,12 @@ static int32_t C_ParseCommand(void) *g_scriptPtr++=i; } else + { + g_numCompilerErrors++; C_ReportError(ERROR_NOTAGAMEARRAY); + return 1; + } + C_SkipComments();// skip comments and whitespace if (*textptr != '[') { @@ -4032,7 +4046,11 @@ static int32_t C_ParseCommand(void) *g_scriptPtr++=i; } else + { + g_numCompilerErrors++; C_ReportError(ERROR_NOTAGAMEARRAY); + return 1; + } C_SkipComments(); C_GetNextVar(); return 0; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 458b18f3f..28df0b0fd 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -333,7 +333,7 @@ void A_Fall(int32_t iActor) 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; s->cstat = 0; @@ -2251,7 +2251,7 @@ nullquote: int32_t y1=scale(Gv_GetVarX(*insptr++),ydim,200); int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320); 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) int32_t j; #endif @@ -4822,9 +4822,9 @@ void G_SaveMapState(mapstate_t *save) Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect)); Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect)); Bmemcpy(&save->nextspritesect[0],&nextspritesect[0],sizeof(nextspritesect)); - Bmemcpy(&save->headspritestat[STAT_DEFAULT],&headspritestat[STAT_DEFAULT],sizeof(headspritestat)); - Bmemcpy(&save->prevspritestat[STAT_DEFAULT],&prevspritestat[STAT_DEFAULT],sizeof(prevspritestat)); - Bmemcpy(&save->nextspritestat[STAT_DEFAULT],&nextspritestat[STAT_DEFAULT],sizeof(nextspritestat)); + Bmemcpy(&save->headspritestat[0],&headspritestat[0],sizeof(headspritestat)); + Bmemcpy(&save->prevspritestat[0],&prevspritestat[0],sizeof(prevspritestat)); + Bmemcpy(&save->nextspritestat[0],&nextspritestat[0],sizeof(nextspritestat)); 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(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect)); Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect)); - Bmemcpy(&headspritestat[STAT_DEFAULT],&save->headspritestat[STAT_DEFAULT],sizeof(headspritestat)); - Bmemcpy(&prevspritestat[STAT_DEFAULT],&save->prevspritestat[STAT_DEFAULT],sizeof(prevspritestat)); - Bmemcpy(&nextspritestat[STAT_DEFAULT],&save->nextspritestat[STAT_DEFAULT],sizeof(nextspritestat)); + Bmemcpy(&headspritestat[0],&save->headspritestat[0],sizeof(headspritestat)); + Bmemcpy(&prevspritestat[0],&save->prevspritestat[0],sizeof(prevspritestat)); + Bmemcpy(&nextspritestat[0],&save->nextspritestat[0],sizeof(nextspritestat)); Bmemcpy(&ActorExtra[0],&save->ActorExtra[0],sizeof(ActorData_t)*MAXSPRITES); for (i=MAXSPRITES-1; i>=0; i--) diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 3c6ccdabb..e6e30947d 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -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,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,139+8,"VERSION OF DUKE NUKEM 3D.",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", "-", "-", - "Net packets per second", - "-", - "-", "Multiplayer macros", NULL }; @@ -825,14 +822,7 @@ void M_DisplayMenus(void) G_UpdatePlayerFromMenu(); } break; -#ifndef RANCID_NETWORKING 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) { ChangeToMenu(20004); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index b15fdedf8..3b79fcc16 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -133,13 +133,13 @@ static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t y1 += yv; z1 += zv; updatesector(x1,y1,§); - if (sect >= 0) - { - 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); - else - A_InsertSprite(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps->i,5); - } + if (sect < 0) + break; + + 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); + else + A_InsertSprite(sect,x1,y1,z1,SMALLSMOKE,-32,14,14,0,0,0,g_player[0].ps->i,5); } } @@ -696,20 +696,26 @@ int32_t A_Shoot(int32_t i,int32_t atwith) if (j == -1) { - sa += (angRange/2)-(krand()&(angRange-1)); zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; - zvel += (zRange/2)-(krand()&(zRange-1)); + if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + { + sa += (angRange/2)-(krand()&(angRange-1)); + zvel += (zRange/2)-(krand()&(zRange-1)); + } } } else { - sa += (angRange/2)-(krand()&(angRange-1)); if (j == -1) { // no target zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; } - zvel += (zRange/2)-(krand()&(zRange-1)); + if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + { + sa += (angRange/2)-(krand()&(angRange-1)); + zvel += (zRange/2)-(krand()&(zRange-1)); + } } srcvect.z -= (2<<8); } @@ -723,13 +729,21 @@ int32_t A_Shoot(int32_t i,int32_t atwith) zvel = ((g_player[j].ps->posz-srcvect.z) <<8) / hitinfo.pos.x; if (s->picnum != BOSS1) { - zvel += 128-(krand()&255); - sa += 32-(krand()&63); + if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + { + zvel += 128-(krand()&255); + sa += 32-(krand()&63); + } } else { - zvel += 128-(krand()&255); - sa = getangle(g_player[j].ps->posx-srcvect.x,g_player[j].ps->posy-srcvect.y)+64-(krand()&127); + 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); + sa += 64-(krand()&127); + } } } @@ -753,9 +767,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith) return -1; if (ProjectileData[atwith].trail >= 0) - { A_HitscanProjTrail(&srcvect,&hitinfo.pos,sa,atwith); - } if (ProjectileData[atwith].workslike & PROJECTILE_WATERBUBBLES) { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 0b43ba98f..7ee909f5f 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1613,10 +1613,10 @@ void clearfifo(void) void Net_ResetPrediction(void) { - my.x = omy.x = g_player[myconnectindex].ps->posx; - my.y = omy.y = g_player[myconnectindex].ps->posy; - my.z = omy.z = g_player[myconnectindex].ps->posz; - myvel.x = myvel.y = myvel.z = 0; + Bmemcpy(&my, &g_player[myconnectindex].ps, sizeof(vec3_t)); + Bmemcpy(&omy, &g_player[myconnectindex].ps, sizeof(vec3_t)); + Bmemset(&myvel, 0, sizeof(vec3_t)); + myang = omyang = g_player[myconnectindex].ps->ang; myhoriz = omyhoriz = g_player[myconnectindex].ps->horiz; myhorizoff = omyhorizoff = g_player[myconnectindex].ps->horizoff; diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 1876b30ee..4f5a266ff 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -357,10 +357,7 @@ int32_t SetAnimation(int32_t animsect,int32_t *animptr, int32_t thegoal, int32_t animatesect[j] = animsect; animateptr[j] = animptr; animategoal[j] = thegoal; - if (thegoal >= *animptr) - animatevel[j] = thevel; - else - animatevel[j] = -thevel; + animatevel[j] = (thegoal >= *animptr) ? thevel : -thevel; if (j == g_animateCount) g_animateCount++; @@ -375,13 +372,13 @@ void G_AnimateCamSprite(void) if (camsprite <= 0) return; - if (T1 >= 11) + if (T1 >= 4) { T1 = 0; if (g_player[screenpeek].ps->newowner >= 0) 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) allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]); @@ -1008,6 +1005,7 @@ void G_OperateActivators(int32_t low,int32_t snum) i = headspritestat[STAT_ACTIVATOR]; k = -1; + while (i >= 0) { 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 (ActorExtra[w].lasttransport == totalclock) return 0; + ActorExtra[w].lasttransport = totalclock; lotag = sprite[w].lotag; if (lotag == 0) return 0; hitag = sprite[w].hitag; // sx = sprite[w].x; // sy = sprite[w].y; - Bmemcpy(&davector, &sprite[w], sizeof(int32_t) * 3); + Bmemcpy(&davector, &sprite[w], sizeof(vec3_t)); picnum = sprite[w].picnum; switchpal = sprite[w].pal; } @@ -2619,26 +2619,26 @@ CHECKINV1: case 4: if (p->jetpack_amount > 0 && i > 1) break; - if (k) dainv = 5; - else dainv = 3; + if (k) dainv++; + else dainv--; goto CHECKINV1; case 6: if (p->scuba_amount > 0 && i > 1) break; - if (k) dainv = 7; - else dainv = 5; + if (k) dainv++; + else dainv--; goto CHECKINV1; case 2: if (p->steroids_amount > 0 && i > 1) break; - if (k) dainv = 3; - else dainv = 1; + if (k) dainv++; + else dainv--; goto CHECKINV1; case 3: if (p->holoduke_amount > 0 && i > 1) break; - if (k) dainv = 4; - else dainv = 2; + if (k) dainv++; + else dainv--; goto CHECKINV1; case 0: case 1: @@ -2650,8 +2650,8 @@ CHECKINV1: case 5: if (p->heat_amount > 0 && i > 1) break; - if (k) dainv = 6; - else dainv = 4; + if (k) dainv++; + else dainv--; goto CHECKINV1; case 7: if (p->boot_amount > 0 && i > 1) @@ -2678,14 +2678,14 @@ CHECKINV1: dainv=aGameVars[g_iReturnVarID].val.lValue; } - if (dainv > -1) + if (dainv >= 1) { p->inven_icon = dainv; if (dainv || p->firstaid_amount) { 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&2047], 0,&hitinfo,CLIPMASK1); - SZ += zoff; + *hitsp = hitinfo.hitsprite; if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i])) return((1<<30)); @@ -3048,7 +3048,7 @@ void P_CheckSectors(int32_t snum) return; case -1: TRAVERSE_CONNECT(i) - g_player[i].ps->gm = MODE_EOL; + g_player[i].ps->gm = MODE_EOL; sector[p->cursectnum].lotag = 0; if (ud.from_bonus) { @@ -3226,13 +3226,13 @@ void P_CheckSectors(int32_t snum) return; case NUKEBUTTON__STATIC: - hitawall(p,&j); if (j >= 0 && wall[j].overpicnum == 0) if (ActorExtra[neartagsprite].temp_data[0] == 0) { if (ud.noexits && ud.multimode > 1) { + // NUKEBUTTON frags the player ActorExtra[p->i].picnum = NUKEBUTTON; ActorExtra[p->i].extra = 250; } @@ -3247,6 +3247,7 @@ void P_CheckSectors(int32_t snum) } } return; + case WATERFOUNTAIN__STATIC: if (ActorExtra[neartagsprite].temp_data[0] != 1) { @@ -3260,6 +3261,7 @@ void P_CheckSectors(int32_t snum) } } return; + case PLUG__STATIC: A_PlaySound(SHORT_CIRCUIT,p->i); sprite[p->i].extra -= 2+(krand()&3); @@ -3268,6 +3270,7 @@ void P_CheckSectors(int32_t snum) p->pals[2] = 64; p->pals_time = 32; break; + case VIEWSCREEN__STATIC: case VIEWSCREEN2__STATIC: { @@ -3301,9 +3304,7 @@ CLEARCAMERAS: if (i < 0) { - p->posx = p->oposx; - p->posy = p->oposy; - p->posz = p->oposz; + Bmemcpy(p, &p->oposx, sizeof(vec3_t)); p->ang = p->oang; p->newowner = -1; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index cac3b3a9e..9db0b96dc 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -652,10 +652,18 @@ int32_t A_PlaySound(uint32_t num, int32_t i) 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); -// S_TestSoundCallback(num); + 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); + } + } } } @@ -673,7 +681,6 @@ void S_StopEnvSound(int32_t num,int32_t i) { FX_StopSound(g_sounds[num].SoundOwner[j].voice); // S_TestSoundCallback(num); - return; } } } @@ -772,44 +779,35 @@ void S_Pan3D(void) void S_TestSoundCallback(uint32_t num) { - int32_t tempi,tempj,tempk; + if ((int32_t)num == MUSIC_ID) + return; - if ((int32_t) num == MUSIC_ID) - { - return; - } - - if((int32_t)num < 0) - { - if(lumplockbyte[-(int32_t)num] >= 200) - lumplockbyte[-(int32_t)num]--; - return; - } - - tempk = g_sounds[num].num; - - if (tempk > 0) + if ((int32_t)num < 0) { - if ((g_sounds[num].m&16) == 0) - for (tempj=0; tempj= 200) + lumplockbyte[-(int32_t)num]--; + return; } + { + int32_t j = 0; + + while (j < g_sounds[num].num) + { + if (!FX_SoundActive(g_sounds[num].SoundOwner[j].voice)) + { + int32_t i = g_sounds[num].SoundOwner[j].i; + + g_sounds[num].num--; + // 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]--; }