diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index ef67c2b96..bd6a49094 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -480,6 +480,8 @@ int32_t setsprite(int16_t spritenum, int32_t newx, int32_t newy, int32_t newz) int32_t screencapture(char *filename, char inverseit); +int32_t getclosestcol(int32_t r, int32_t g, int32_t b); + // PLAG: line utility functions typedef struct s_equation { float a, b, c; diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 100e528a3..ade1d3cac 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -823,9 +823,11 @@ void editinput(void) goalz += mousz; if (keystatus[buildkeys[BK_MOVEUP]]) //A (stand high) { +/* if (keystatus[0x1d]|keystatus[0x9d]) horiz = max(-100,horiz-((keystatus[buildkeys[BK_RUN]]+1)*synctics*2)); else +*/ { goalz -= (16<<8); if (keystatus[buildkeys[BK_RUN]]) //Either shift key @@ -834,9 +836,11 @@ void editinput(void) } if (keystatus[buildkeys[BK_MOVEDOWN]]) //Z (stand low) { +/* if (keystatus[0x1d]|keystatus[0x9d]) horiz = min(300,horiz+((keystatus[buildkeys[BK_RUN]]+1)*synctics*2)); else +*/ { goalz += (12<<8); if (keystatus[buildkeys[BK_RUN]]) //Either shift key diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 5226d7f59..1c6d96e96 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -289,7 +289,6 @@ extern int32_t nextvoxid; extern char faketile[MAXTILES]; extern char *faketiledata[MAXTILES]; -extern int32_t getclosestcol(int32_t r, int32_t g, int32_t b); #if defined(POLYMOST) && defined(USE_OPENGL) extern float alphahackarray[MAXTILES]; diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index f3a242c2a..eb771738a 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -335,7 +335,14 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t y1 = (((wal->y+wall[wal->point2].y)>>1)+s->y)>>1; updatesector(x1,y1,§); if (sect >= 0 && cansee(x1,y1,s->z,sect,s->x,s->y,s->z,s->sectnum)) - A_DamageWall(i,x,wal->x,wal->y,s->z,s->picnum); + { + vec3_t tmpvect; + + Bmemcpy(&tmpvect, wal, sizeof(int32_t) * 2); + tmpvect.z = s->z; + + A_DamageWall(i,x,&tmpvect,s->picnum); + } } } while (sectcnt < sectend); @@ -466,7 +473,7 @@ BOLT: } } -int32_t A_MoveSprite(int32_t spritenum, int32_t xchange, int32_t ychange, int32_t zchange, uint32_t cliptype) +int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) { int32_t daz, oldx, oldy; int32_t retval; @@ -475,9 +482,9 @@ int32_t A_MoveSprite(int32_t spritenum, int32_t xchange, int32_t ychange, int32_ if (sprite[spritenum].statnum == 5 || (bg && sprite[spritenum].xrepeat < 4)) { - sprite[spritenum].x += (xchange*TICSPERFRAME)>>2; - sprite[spritenum].y += (ychange*TICSPERFRAME)>>2; - sprite[spritenum].z += (zchange*TICSPERFRAME)>>2; + sprite[spritenum].x += (change->x*TICSPERFRAME)>>2; + sprite[spritenum].y += (change->y*TICSPERFRAME)>>2; + sprite[spritenum].z += (change->z*TICSPERFRAME)>>2; if (bg) setsprite(spritenum,sprite[spritenum].x,sprite[spritenum].y,sprite[spritenum].z); return 0; @@ -493,7 +500,7 @@ int32_t A_MoveSprite(int32_t spritenum, int32_t xchange, int32_t ychange, int32_ oldy = sprite[spritenum].y; if (sprite[spritenum].xrepeat > 60) - retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); + retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),1024L,(4<<8),(4<<8),cliptype); else { if (sprite[spritenum].picnum == LIZMAN) @@ -503,7 +510,7 @@ int32_t A_MoveSprite(int32_t spritenum, int32_t xchange, int32_t ychange, int32_ else cd = 192L; - retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); + retval = clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),cd,(4<<8),(4<<8),cliptype); } if (dasectnum < 0 || (dasectnum >= 0 && @@ -530,16 +537,16 @@ int32_t A_MoveSprite(int32_t spritenum, int32_t xchange, int32_t ychange, int32_ { if (sprite[spritenum].statnum == 4) retval = - clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); + clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),8L,(4<<8),(4<<8),cliptype); else retval = - clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((xchange*TICSPERFRAME)<<11),((ychange*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype); + clipmove(&sprite[spritenum].x,&sprite[spritenum].y,&daz,&dasectnum,((change->x*TICSPERFRAME)<<11),((change->y*TICSPERFRAME)<<11),(int32_t)(sprite[spritenum].clipdist<<2),(4<<8),(4<<8),cliptype); } if (dasectnum >= 0) if ((dasectnum != sprite[spritenum].sectnum)) changespritesect(spritenum,dasectnum); - daz = sprite[spritenum].z + ((zchange*TICSPERFRAME)>>3); + daz = sprite[spritenum].z + ((change->z*TICSPERFRAME)>>3); if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)) sprite[spritenum].z = daz; else if (retval == 0) @@ -550,9 +557,12 @@ int32_t A_MoveSprite(int32_t spritenum, int32_t xchange, int32_t ychange, int32_ inline int32_t A_SetSprite(int32_t i,uint32_t cliptype) //The set sprite function { - return (A_MoveSprite(i,(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, - (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,sprite[i].zvel, - cliptype)==0); + 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; + return (A_MoveSprite(i,&davect,cliptype)==0); } #undef deletesprite @@ -2347,7 +2357,8 @@ static void A_DoProjectileBounce(int32_t i) static void G_MoveWeapons(void) { int32_t i = headspritestat[STAT_PROJECTILE], j=0, k, f, nexti, p, q; - int32_t dax,day,daz, x, ll; + vec3_t davect; + int32_t x, ll; uint32_t qq; spritetype *s; @@ -2403,9 +2414,12 @@ static void G_MoveWeapons(void) ll = s->zvel>>1; } - dax = s->x; - day = s->y; - daz = s->z; + Bmemcpy(&davect,s,sizeof(int32_t) * 3); + /* + dax = s->x; + day = s->y; + daz = s->z; + */ A_GetZLimits(i); qq = CLIPMASK1; @@ -2426,12 +2440,19 @@ static void G_MoveWeapons(void) for (f=1;f<=ActorExtra[i].projectile.velmult;f++) { - dax = s->x; - day = s->y; - daz = s->z; - j = A_MoveSprite(i, - (k*(sintable[(s->ang+512)&2047]))>>14, - (k*(sintable[s->ang&2047]))>>14,ll,qq); + vec3_t tmpvect; + /* + dax = s->x; + day = s->y; + daz = s->z; + */ + Bmemcpy(&davect,s,sizeof(int32_t) * 3); + + tmpvect.x = (k*(sintable[(s->ang+512)&2047]))>>14; + tmpvect.y = (k*(sintable[s->ang&2047]))>>14; + tmpvect.z = ll; + + j = A_MoveSprite(i,&tmpvect,qq); if (j) break; } @@ -2462,9 +2483,13 @@ static void G_MoveWeapons(void) if (ActorExtra[i].projectile.spawns >= 0) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; + + Bmemcpy(&sprite[k],&davect,sizeof(int32_t) * 3); + /* + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2496,9 +2521,13 @@ static void G_MoveWeapons(void) if (ActorExtra[i].projectile.spawns >= 0) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; + + Bmemcpy(&sprite[k],&davect,sizeof(int32_t) * 3); + /* + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2612,9 +2641,12 @@ static void G_MoveWeapons(void) if (ActorExtra[i].projectile.spawns >= 0) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; + Bmemcpy(&sprite[k],&davect,sizeof(int32_t) * 3); + /* + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2648,8 +2680,10 @@ static void G_MoveWeapons(void) } else { - setsprite(i,dax,day,daz); - A_DamageWall(i,j,s->x,s->y,s->z,s->picnum); + vec3_t tmpvect; + setsprite(i,davect.x,davect.y,davect.z); + Bmemcpy(&tmpvect, s, sizeof(int32_t) * 3); + A_DamageWall(i,j,&tmpvect,s->picnum); if (ActorExtra[i].projectile.workslike & PROJECTILE_BOUNCESOFFWALLS) { @@ -2675,7 +2709,7 @@ static void G_MoveWeapons(void) } else if ((j&49152) == 16384) { - setsprite(i,dax,day,daz); + setsprite(i,davect.x,davect.y,davect.z); if (s->zvel < 0) { @@ -2708,9 +2742,12 @@ static void G_MoveWeapons(void) if (ActorExtra[i].projectile.workslike & PROJECTILE_RPG && ActorExtra[i].projectile.spawns > 0) { k = A_Spawn(i,ActorExtra[i].projectile.spawns); - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; + Bmemcpy(&sprite[k],&davect,sizeof(int32_t) * 3); + /* + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + */ if (ActorExtra[i].projectile.sxrepeat > 4) sprite[k].xrepeat=ActorExtra[i].projectile.sxrepeat; @@ -2819,9 +2856,12 @@ static void G_MoveWeapons(void) ll = s->zvel>>1; } - dax = s->x; - day = s->y; - daz = s->z; + Bmemcpy(&davect,s,sizeof(int32_t) * 3); + /* + dax = s->x; + day = s->y; + daz = s->z; + */ A_GetZLimits(i); qq = CLIPMASK1; @@ -2837,7 +2877,15 @@ static void G_MoveWeapons(void) break; } - j = A_MoveSprite(i,(k*(sintable[(s->ang+512)&2047]))>>14,(k*(sintable[s->ang&2047]))>>14,ll,qq); + { + vec3_t tmpvect; + + tmpvect.x = (k*(sintable[(s->ang+512)&2047]))>>14; + tmpvect.y = (k*(sintable[s->ang&2047]))>>14; + tmpvect.z = ll; + j = A_MoveSprite(i,&tmpvect,qq); + } + if (s->picnum == RPG && s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS) if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256) @@ -2953,8 +3001,10 @@ static void G_MoveWeapons(void) } else { - setsprite(i,dax,day,daz); - A_DamageWall(i,j,s->x,s->y,s->z,s->picnum); + vec3_t tmpvect; + setsprite(i,davect.x,davect.y,davect.z); + Bmemcpy(&tmpvect, s, sizeof(int32_t) * 3); + A_DamageWall(i,j,&tmpvect,s->picnum); if (s->picnum == FREEZEBLAST) { @@ -2974,7 +3024,7 @@ static void G_MoveWeapons(void) } else if ((j&49152) == 16384) { - setsprite(i,dax,day,daz); + setsprite(i,davect.x,davect.y,davect.z); if (s->zvel < 0) { @@ -3004,9 +3054,12 @@ static void G_MoveWeapons(void) if (s->picnum == RPG) { k = A_Spawn(i,EXPLOSION2); - sprite[k].x = dax; - sprite[k].y = day; - sprite[k].z = daz; + Bmemcpy(&sprite[k],&davect,sizeof(int32_t) * 3); + /* + sprite[k].x = dax; + sprite[k].y = day; + sprite[k].z = daz; + */ if (s->xrepeat < 10) { @@ -4355,10 +4408,14 @@ static void G_MoveActors(void) } } - j = A_MoveSprite(i, - (s->xvel*(sintable[(s->ang+512)&2047]))>>14, - (s->xvel*(sintable[s->ang&2047]))>>14, - s->zvel,CLIPMASK0); + { + vec3_t tmpvect; + + tmpvect.x = (s->xvel*(sintable[(s->ang+512)&2047]))>>14; + tmpvect.y = (s->xvel*(sintable[s->ang&2047]))>>14; + tmpvect.z = s->zvel; + j = A_MoveSprite(i,&tmpvect,CLIPMASK0); + } ActorExtra[i].movflag = j; @@ -4399,9 +4456,12 @@ static void G_MoveActors(void) if ((j&49152) == 32768) { + vec3_t davect; + j &= (MAXWALLS-1); - A_DamageWall(i,j,s->x,s->y,s->z,s->picnum); + Bmemcpy(&davect, s, sizeof(int32_t) * 3); + A_DamageWall(i,j,&davect,s->picnum); k = getangle( wall[wall[j].point2].x-wall[j].x, diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 72998993f..8a9bc1b65 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -7263,8 +7263,6 @@ static void InitCustomColors(void) editorcolors[4] = getclosestcol(42,0,0); editorcolors[5] = getclosestcol(0,0,0); */ - extern int32_t getclosestcol(int32_t r, int32_t g, int32_t b); - vgapal16[9*4+0] = 63; vgapal16[9*4+1] = 31; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 973e27a1c..7aa4299b9 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -574,6 +574,10 @@ extern int32_t movefifoplc, vel,svel,angvel,horiz; extern int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount; +typedef struct { + int32_t x, y, z; +} vec3_t; + #include "funct.h" extern int32_t g_screenCapture; @@ -588,28 +592,26 @@ extern int32_t GametypeFlags[MAXGAMETYPES]; extern char g_numGametypes; enum GametypeFlags_t { - GAMETYPE_COOP = 1, - GAMETYPE_WEAPSTAY = 2, - GAMETYPE_FRAGBAR = 4, - GAMETYPE_SCORESHEET = 8, - GAMETYPE_DMSWITCHES = 16, - GAMETYPE_COOPSPAWN = 32, - GAMETYPE_ACCESSCARDSPRITES = 64, - GAMETYPE_COOPVIEW = 128, - GAMETYPE_COOPSOUND = 256, - GAMETYPE_OTHERPLAYERSINMAP = 512, - GAMETYPE_ITEMRESPAWN = 1024, - GAMETYPE_MARKEROPTION = 2048, - GAMETYPE_PLAYERSFRIENDLY = 4096, - GAMETYPE_FIXEDRESPAWN = 8192, - GAMETYPE_ACCESSATSTART = 16384, - GAMETYPE_PRESERVEINVENTORYDEATH = 32768, - GAMETYPE_TDM = 65536, - GAMETYPE_TDMSPAWN = 131072 + GAMETYPE_COOP = 0x00000001, + GAMETYPE_WEAPSTAY = 0x00000002, + GAMETYPE_FRAGBAR = 0x00000004, + GAMETYPE_SCORESHEET = 0x00000008, + GAMETYPE_DMSWITCHES = 0x00000010, + GAMETYPE_COOPSPAWN = 0x00000020, + GAMETYPE_ACCESSCARDSPRITES = 0x00000040, + GAMETYPE_COOPVIEW = 0x00000080, + GAMETYPE_COOPSOUND = 0x00000100, + GAMETYPE_OTHERPLAYERSINMAP = 0x00000200, + GAMETYPE_ITEMRESPAWN = 0x00000400, + GAMETYPE_MARKEROPTION = 0x00000800, + GAMETYPE_PLAYERSFRIENDLY = 0x00001000, + GAMETYPE_FIXEDRESPAWN = 0x00002000, + GAMETYPE_ACCESSATSTART = 0x00004000, + GAMETYPE_PRESERVEINVENTORYDEATH = 0x00008000, + GAMETYPE_TDM = 0x00010000, + GAMETYPE_TDMSPAWN = 0x00020000 }; -#define GTFLAGS(x) (GametypeFlags[ud.coop] & x) - extern char g_numVolumes; extern int32_t g_lastSaveSlot; @@ -785,14 +787,6 @@ enum GameEvent_t { MAXEVENTS }; -enum SystemString_t { - STR_MAPNAME, - STR_MAPFILENAME, - STR_PLAYERNAME, - STR_VERSION, - STR_GAMETYPE -}; - // store global game definitions @@ -1004,19 +998,18 @@ typedef struct { animwalltype animwall[MAXANIMWALLS]; int32_t msx[2048], msy[2048]; int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount; - char show2dsector[(MAXSECTORS+7)>>3]; + uint8_t show2dsector[(MAXSECTORS+7)>>3]; int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128]; ActorData_t ActorExtra[MAXSPRITES]; int16_t pskyoff[MAXPSKYTILES], pskybits; - int32_t animategoal[MAXANIMATES], animatevel[MAXANIMATES], g_animateCount; int16_t animatesect[MAXANIMATES]; int32_t animateptr[MAXANIMATES]; - char g_numPlayerSprites; - char g_earthquakeTime; + uint8_t g_numPlayerSprites; + uint8_t g_earthquakeTime; int32_t lockclock; int32_t randomseed, g_globalRandom; - char scriptptrs[MAXSPRITES]; + uint8_t scriptptrs[MAXSPRITES]; intptr_t *vars[MAXGAMEVARS]; } mapstate_t; diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index 706f85624..98ccf45b3 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -43,7 +43,7 @@ extern void S_MusicShutdown(void); extern void S_MenuSound(void); extern int32_t S_PlayMusic(const char *fn, const int32_t sel); extern int32_t S_LoadSound(unsigned num); -extern int32_t S_PlaySoundXYZ(int32_t num,int32_t i,int32_t x,int32_t y,int32_t z); +extern int32_t S_PlaySoundXYZ(int32_t num,int32_t i,const vec3_t *pos); extern void S_PlaySound(int32_t num); extern int32_t A_PlaySound(uint32_t num,int32_t i); extern void S_StopSound(int32_t num); @@ -74,7 +74,7 @@ extern void G_OperateMasterSwitches(int32_t low); extern void G_OperateForceFields(int32_t s,int32_t low); extern int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype); extern void activatebysector(int32_t sect,int32_t j); -extern void A_DamageWall(int32_t spr,int32_t dawallnum,int32_t x,int32_t y,int32_t z,int32_t atwith); +extern void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith); extern void P_CheckTouchDamage(DukePlayer_t *p,int32_t j); extern int32_t Sect_DamageCeiling(int32_t sn); extern void A_DamageObject(int32_t i,int32_t sn); @@ -127,7 +127,6 @@ extern void A_Fall(int32_t iActor); extern void C_Compile(const char *fn); extern int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs); extern void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist); -extern void overwritesprite(int32_t thex,int32_t they,int32_t tilenum,int32_t shade,int32_t stat,int32_t dapalnum); extern void gamenumber(int32_t x,int32_t y,int32_t n,int32_t s); extern void G_Shutdown(void); extern void Net_GetPackets(void); @@ -180,7 +179,7 @@ extern void P_AddWeapon(DukePlayer_t *p,int32_t weapon); extern void P_SelectNextInvItem(DukePlayer_t *p); extern void P_CheckWeapon(DukePlayer_t *p); extern void A_RadiusDamage(int32_t i,int32_t r,int32_t hp1,int32_t hp2,int32_t hp3,int32_t hp4); -extern int32_t A_MoveSprite(int32_t spritenum,int32_t xchange,int32_t ychange,int32_t zchange,uint32_t cliptype); +extern int32_t A_MoveSprite(int32_t spritenum,const vec3_t *change,uint32_t cliptype); extern inline int32_t A_SetSprite(int32_t i,uint32_t cliptype); extern void A_AddToDeleteQueue(int32_t i); extern void A_SpawnMultiple(int32_t sp,int32_t pic,int32_t n); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index cd7ddf1bb..287a96482 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -305,7 +305,7 @@ int32_t gametext_z(int32_t small, int32_t starttile, int32_t x,int32_t y,const c { int32_t ac,newx,oldx=x; char centre; - char *oldt; + char *oldt; int32_t squishtext = ((small&2)!=0); // int32_t ht = usehightile; int32_t shift = 16, widthx = 320, ox, oy; @@ -2034,9 +2034,9 @@ static void G_DrawStatusBar(int32_t snum) the HUD is drawn */ int32_t asprites[MAX_WEAPONS] = { BOOTS, AMMO, SHOTGUNAMMO, - BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, - TRIPBOMBSPRITE, FREEZEAMMO+1, HBOMBAMMO, GROWAMMO - }; + BATTERYAMMO, RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO, + TRIPBOMBSPRITE, FREEZEAMMO+1, HBOMBAMMO, GROWAMMO + }; Bmemcpy(ammo_sprites,asprites,sizeof(ammo_sprites)); } @@ -2855,30 +2855,30 @@ void G_GameExit(const char *t) if (*t != 0) g_player[myconnectindex].ps->palette = (unsigned char *) &palette[0]; if (numplayers > 1) - { - int32_t i, j, oldtotalclock; + { + int32_t i, j, oldtotalclock; - ready2send = 0; + ready2send = 0; - for (j=MAXPLAYERS-1;j>=0;j--) - { - oldtotalclock = totalclock; + for (j=MAXPLAYERS-1;j>=0;j--) + { + oldtotalclock = totalclock; - while (totalclock < oldtotalclock+TICSPERFRAME) - { - handleevents(); - Net_GetPackets(); - } - if (KB_KeyPressed(sc_Escape)) return; + while (totalclock < oldtotalclock+TICSPERFRAME) + { + handleevents(); + Net_GetPackets(); + } + if (KB_KeyPressed(sc_Escape)) return; - packbuf[0] = PACKET_NULL_PACKET; - TRAVERSE_CONNECT(i) - { - if (i != myconnectindex) mmulti_sendpacket(i,packbuf,1); - if ((!g_networkBroadcastMode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master - } - } - } + packbuf[0] = PACKET_NULL_PACKET; + TRAVERSE_CONNECT(i) + { + if (i != myconnectindex) mmulti_sendpacket(i,packbuf,1); + if ((!g_networkBroadcastMode) && (myconnectindex != connecthead)) break; //slaves in M/S mode only send to master + } + } + } mmulti_uninitmultiplayers(); @@ -3473,7 +3473,6 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 #define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1) -extern int32_t getclosestcol(int32_t r, int32_t g, int32_t b); palette_t CrosshairColors = { 255, 255, 255, 0 }; palette_t DefaultCrosshairColors = { 0, 0, 0, 0 }; int32_t g_crosshairSum = 0; @@ -3598,7 +3597,7 @@ void G_DisplayRest(int32_t smoothratio) DukePlayer_t *pp = g_player[screenpeek].ps; walltype *wal; - int32_t cposx,cposy,cang; + int32_t cposx, cposy, cang; #if defined(USE_OPENGL) && defined(POLYMOST) // this takes care of fullscreen tint for OpenGL @@ -7505,7 +7504,7 @@ PALONLY: do { if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; - if (tsprite[j].owner < MAXSPRITES && tsprite[j].owner > 0 && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) + if (tsprite[j].owner < MAXSPRITES && tsprite[j].owner >= 0 && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) { spriteext[tsprite[j].owner].tspr = (spritetype *)&tsprite[j]; X_OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1); @@ -7516,7 +7515,7 @@ PALONLY: if (j < 0) return; if (display_mirror) tsprite[j].statnum = TSPR_MIRROR; - if (tsprite[j].owner > 0 && tsprite[j].owner < MAXSPRITES && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) + if (tsprite[j].owner >= 0 && tsprite[j].owner < MAXSPRITES && spriteext[tsprite[j].owner].flags & SPREXT_TSPRACCESS) { spriteext[tsprite[j].owner].tspr = (spritetype *)&tsprite[j]; X_OnEvent(EVENT_ANIMATESPRITES,tsprite[j].owner, myconnectindex, -1); @@ -10707,7 +10706,7 @@ void G_UpdatePlayerFromMenu(void) g_player[myconnectindex].ps->auto_aim = ud.config.AutoAim; g_player[myconnectindex].ps->weaponswitch = ud.weaponswitch; g_player[myconnectindex].ps->palookup = g_player[myconnectindex].pcolor = ud.color; - + g_player[myconnectindex].pteam = ud.team; if (sprite[g_player[myconnectindex].ps->i].picnum == APLAYER && sprite[g_player[myconnectindex].ps->i].pal != 1) @@ -10966,12 +10965,12 @@ void app_main(int32_t argc,const char **argv) if (!ShellExecuteExA(&sinfo)) initprintf("update: error launching browser!\n"); -/* - CONFIG_SetupMouse(); - CONFIG_SetupJoystick(); - CONFIG_WriteSetup(); - G_GameExit(" "); -*/ + /* + CONFIG_SetupMouse(); + CONFIG_SetupJoystick(); + CONFIG_WriteSetup(); + G_GameExit(" "); + */ } } else initprintf("... no updates available\n"); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index d5385407e..7a0704d67 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1646,7 +1646,7 @@ static void C_GetNextVarType(int32_t type) lLabelID=C_GetLabelNameOffset(&wallH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); else if (i == g_iPlayerVarID) lLabelID=C_GetLabelNameOffset(&playerH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); - + //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -1734,8 +1734,8 @@ static void C_GetNextVarType(int32_t type) { C_ReportError(-1); initprintf("%s:%d: warning: found local gamevar `%s' used within %s; " - "expect multiplayer synchronization issues.\n",g_szScriptFileName, - g_lineNumber,label+(g_numLabels<<6),g_parsingEventPtr?"a synced event":"an actor"); + "expect multiplayer synchronization issues.\n",g_szScriptFileName, + g_lineNumber,label+(g_numLabels<<6),g_parsingEventPtr?"a synced event":"an actor"); g_numCompilerWarnings++; } if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug > 1) @@ -1838,7 +1838,7 @@ static int32_t C_GetNextValue(int32_t type) i = l-1; do { - // FIXME: check for 0-9 A-F for hex + // FIXME: check for 0-9 A-F for hex if (textptr[0] == '0' && textptr[1] == 'x') break; // kill the warning for hex if (!isdigit(textptr[i--])) { @@ -5738,6 +5738,7 @@ static void C_AddDefaultDefinitions(void) C_AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE); C_AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE); C_AddDefinition("STR_GAMETYPE",STR_GAMETYPE,LABEL_DEFINE); + C_AddDefinition("STR_VOLUMENAME",STR_VOLUMENAME,LABEL_DEFINE); C_AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE); @@ -5985,13 +5986,13 @@ void C_Compile(const char *filenam) initprintf("Script compiled in %dms\n", getticks() - startcompiletime); initprintf("Compiled code size: %ld*%d bytes, version %s\n", - (unsigned)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); + (unsigned)(g_scriptPtr-script), sizeof(intptr_t), (g_scriptVersion == 14?"1.4+":"1.3D")); initprintf("Pointer bitmap size: %ld bytes\n",(g_scriptSize+7)>>3); initprintf("%ld/%ld labels, %d/%d variables\n", g_numLabels, - min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)), - MAXSPRITES * sizeof(spritetype)/(1<<6)), - g_gameVarCount, MAXGAMEVARS); + min((MAXSECTORS * sizeof(sectortype)/sizeof(int32_t)), + MAXSPRITES * sizeof(spritetype)/(1<<6)), + g_gameVarCount, MAXGAMEVARS); for (i=MAXQUOTES-1;i>=0;i--) if (ScriptQuotes[i]) @@ -6111,92 +6112,92 @@ void C_Compile(const char *filenam) void C_ReportError(int32_t iError) { - if (Bstrcmp(g_szCurrentBlockName,g_szLastBlockName)) - { - if (g_parsingEventPtr || g_processingState || g_parsingActorPtr) - initprintf("%s: In %s `%s':\n",g_szScriptFileName,g_parsingEventPtr?"event":g_parsingActorPtr?"actor":"state",g_szCurrentBlockName); - else initprintf("%s: At top level:\n",g_szScriptFileName); - Bstrcpy(g_szLastBlockName,g_szCurrentBlockName); - } - switch (iError) - { - case ERROR_CLOSEBRACKET: - initprintf("%s:%d: error: found more `}' than `{' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_EVENTONLY: - initprintf("%s:%d: error: `%s' only valid during events.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_EXCEEDSMAXTILES: - initprintf("%s:%d: error: `%s' value exceeds MAXTILES. Maximum is %d.\n",g_szScriptFileName,g_lineNumber,tempbuf,MAXTILES-1); - break; - case ERROR_EXPECTEDKEYWORD: - initprintf("%s:%d: error: expected a keyword but found `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_FOUNDWITHIN: - initprintf("%s:%d: error: found `%s' within %s.\n",g_szScriptFileName,g_lineNumber,tempbuf,g_parsingEventPtr?"an event":g_parsingActorPtr?"an actor":"a state"); - break; - case ERROR_ISAKEYWORD: - initprintf("%s:%d: error: symbol `%s' is a keyword.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOENDSWITCH: - initprintf("%s:%d: error: did not find `endswitch' before `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEDEF: - initprintf("%s:%d: error: symbol `%s' is not a game definition.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEVAR: - initprintf("%s:%d: error: symbol `%s' is not a game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_NOTAGAMEARRAY: - initprintf("%s:%d: error: symbol `%s' is not a game array.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_GAMEARRAYBNC: - initprintf("%s:%d: error: square brackets for index of game array not closed, expected ] found %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_GAMEARRAYBNO: - initprintf("%s:%d: error: square brackets for index of game array not opened, expected [ found %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_INVALIDARRAYWRITE: - initprintf("%s:%d: error: arrays can only be written to using `setarray' %c\n",g_szScriptFileName,g_lineNumber,*textptr); - break; - case ERROR_OPENBRACKET: - initprintf("%s:%d: error: found more `{' than `}' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_PARAMUNDEFINED: - initprintf("%s:%d: error: parameter `%s' is undefined.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case ERROR_SYMBOLNOTRECOGNIZED: - initprintf("%s:%d: error: symbol `%s' is not recognized.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_SYNTAXERROR: - initprintf("%s:%d: error: syntax error.\n",g_szScriptFileName,g_lineNumber); - break; - case ERROR_VARREADONLY: - initprintf("%s:%d: error: variable `%s' is read-only.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case ERROR_VARTYPEMISMATCH: - initprintf("%s:%d: error: variable `%s' is of the wrong type.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_BADGAMEVAR: - initprintf("%s:%ld: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_DUPLICATECASE: - initprintf("%s:%ld: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); - break; - case WARNING_DUPLICATEDEFINITION: - initprintf("%s:%d: warning: duplicate game definition `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_EVENTSYNC: - initprintf("%s:%d: warning: found `%s' within a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - case WARNING_LABELSONLY: - initprintf("%s:%d: warning: expected a label, found a constant.\n",g_szScriptFileName,g_lineNumber); - break; - case WARNING_NAMEMATCHESVAR: - initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); - break; - case WARNING_REVEVENTSYNC: - initprintf("%s:%d: warning: found `%s' outside of a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); - break; - } + if (Bstrcmp(g_szCurrentBlockName,g_szLastBlockName)) + { + if (g_parsingEventPtr || g_processingState || g_parsingActorPtr) + initprintf("%s: In %s `%s':\n",g_szScriptFileName,g_parsingEventPtr?"event":g_parsingActorPtr?"actor":"state",g_szCurrentBlockName); + else initprintf("%s: At top level:\n",g_szScriptFileName); + Bstrcpy(g_szLastBlockName,g_szCurrentBlockName); + } + switch (iError) + { + case ERROR_CLOSEBRACKET: + initprintf("%s:%d: error: found more `}' than `{' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_EVENTONLY: + initprintf("%s:%d: error: `%s' only valid during events.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_EXCEEDSMAXTILES: + initprintf("%s:%d: error: `%s' value exceeds MAXTILES. Maximum is %d.\n",g_szScriptFileName,g_lineNumber,tempbuf,MAXTILES-1); + break; + case ERROR_EXPECTEDKEYWORD: + initprintf("%s:%d: error: expected a keyword but found `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_FOUNDWITHIN: + initprintf("%s:%d: error: found `%s' within %s.\n",g_szScriptFileName,g_lineNumber,tempbuf,g_parsingEventPtr?"an event":g_parsingActorPtr?"an actor":"a state"); + break; + case ERROR_ISAKEYWORD: + initprintf("%s:%d: error: symbol `%s' is a keyword.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOENDSWITCH: + initprintf("%s:%d: error: did not find `endswitch' before `%s'.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOTAGAMEDEF: + initprintf("%s:%d: error: symbol `%s' is not a game definition.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOTAGAMEVAR: + initprintf("%s:%d: error: symbol `%s' is not a game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_NOTAGAMEARRAY: + initprintf("%s:%d: error: symbol `%s' is not a game array.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_GAMEARRAYBNC: + initprintf("%s:%d: error: square brackets for index of game array not closed, expected ] found %c\n",g_szScriptFileName,g_lineNumber,*textptr); + break; + case ERROR_GAMEARRAYBNO: + initprintf("%s:%d: error: square brackets for index of game array not opened, expected [ found %c\n",g_szScriptFileName,g_lineNumber,*textptr); + break; + case ERROR_INVALIDARRAYWRITE: + initprintf("%s:%d: error: arrays can only be written to using `setarray' %c\n",g_szScriptFileName,g_lineNumber,*textptr); + break; + case ERROR_OPENBRACKET: + initprintf("%s:%d: error: found more `{' than `}' before `%s'.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_PARAMUNDEFINED: + initprintf("%s:%d: error: parameter `%s' is undefined.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case ERROR_SYMBOLNOTRECOGNIZED: + initprintf("%s:%d: error: symbol `%s' is not recognized.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_SYNTAXERROR: + initprintf("%s:%d: error: syntax error.\n",g_szScriptFileName,g_lineNumber); + break; + case ERROR_VARREADONLY: + initprintf("%s:%d: error: variable `%s' is read-only.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case ERROR_VARTYPEMISMATCH: + initprintf("%s:%d: error: variable `%s' is of the wrong type.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_BADGAMEVAR: + initprintf("%s:%ld: warning: variable `%s' should be either per-player OR per-actor, not both.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_DUPLICATECASE: + initprintf("%s:%ld: warning: duplicate case ignored.\n",g_szScriptFileName,g_lineNumber); + break; + case WARNING_DUPLICATEDEFINITION: + initprintf("%s:%d: warning: duplicate game definition `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_EVENTSYNC: + initprintf("%s:%d: warning: found `%s' within a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + case WARNING_LABELSONLY: + initprintf("%s:%d: warning: expected a label, found a constant.\n",g_szScriptFileName,g_lineNumber); + break; + case WARNING_NAMEMATCHESVAR: + initprintf("%s:%d: warning: symbol `%s' already used for game variable.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); + break; + case WARNING_REVEVENTSYNC: + initprintf("%s:%d: warning: found `%s' outside of a local event.\n",g_szScriptFileName,g_lineNumber,tempbuf); + break; + } } diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 92d54e938..d22d4c717 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -113,6 +113,15 @@ extern int32_t g_errorLineNum; extern int32_t g_tw; extern const char *keyw[]; +enum SystemString_t { + STR_MAPNAME, + STR_MAPFILENAME, + STR_PLAYERNAME, + STR_VERSION, + STR_GAMETYPE, + STR_VOLUMENAME +}; + enum ScriptError_t { ERROR_CLOSEBRACKET, diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 5bb007f42..041dae905 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -605,9 +605,14 @@ static void X_Move(void) } } - ActorExtra[vm.g_i].movflag = A_MoveSprite(vm.g_i, - (daxvel*(sintable[(angdif+512)&2047]))>>14, - (daxvel*(sintable[angdif&2047]))>>14,vm.g_sp->zvel,CLIPMASK0); + { + vec3_t tmpvect; + + tmpvect.x = (daxvel*(sintable[(angdif+512)&2047]))>>14; + tmpvect.y = (daxvel*(sintable[angdif&2047]))>>14; + tmpvect.z = vm.g_sp->zvel; + ActorExtra[vm.g_i].movflag = A_MoveSprite(vm.g_i,&tmpvect,CLIPMASK0); + } } if (a) @@ -1095,7 +1100,7 @@ static int32_t X_DoExecute(void) default: // fix for flying/jumping monsters getting stuck in water if (vm.g_sp->hitag & jumptoplayer || (actorscrptr[vm.g_sp->picnum] && - moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1))) + moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1))) { // OSD_Printf("%d\n",*(moveptr+1)); break; @@ -1516,7 +1521,7 @@ static int32_t X_DoExecute(void) insptr++; { int32_t i = Gv_GetVarX(*insptr++), - f=Gv_GetVarX(*insptr++); + f=Gv_GetVarX(*insptr++); j=Gv_GetVarX(*insptr++); if ((i<0 || i>=MAXQUOTES) && g_scriptSanityChecks) OSD_Printf(CON_ERROR "invalid quote ID %d\n",g_errorLineNum,keyw[g_tw],i); @@ -1617,6 +1622,9 @@ static int32_t X_DoExecute(void) case STR_GAMETYPE: Bstrcpy(ScriptQuotes[i],GametypeNames[ud.coop]); break; + case STR_VOLUMENAME: + Bstrcpy(ScriptQuotes[i],EpisodeNames[ud.volume_number]); + break; default: OSD_Printf(CON_ERROR "unknown str ID %d %d\n",g_errorLineNum,keyw[g_tw],i,j); } @@ -2402,7 +2410,11 @@ static int32_t X_DoExecute(void) insptr++; { int32_t spritenum = Gv_GetVarX(*insptr++); - int32_t x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++), z = Gv_GetVarX(*insptr++); + vec3_t davector; + + davector.x = Gv_GetVarX(*insptr++); + davector.y = Gv_GetVarX(*insptr++); + davector.z = Gv_GetVarX(*insptr++); if (tw == CON_SETSPRITE) { @@ -2411,7 +2423,7 @@ static int32_t X_DoExecute(void) OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum); break; } - setsprite(spritenum, x, y, z); + setsprite(spritenum, davector.x, davector.y, davector.z); break; } @@ -2424,7 +2436,7 @@ static int32_t X_DoExecute(void) insptr++; break; } - Gv_SetVarX(*insptr++, A_MoveSprite(spritenum, x, y, z, cliptype)); + Gv_SetVarX(*insptr++, A_MoveSprite(spritenum, &davector, cliptype)); break; } } @@ -3061,17 +3073,17 @@ static int32_t X_DoExecute(void) index=Gv_GetVarX(*insptr++); label=*insptr++; -/* if ((index < aGameArrays[lVarID].size)&&(index>=0)) - { - OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",g_errorLineNum,keyw[g_tw], - aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]); - break; - } - else - { - OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); - break; - } */ + /* if ((index < aGameArrays[lVarID].size)&&(index>=0)) + { + OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n",g_errorLineNum,keyw[g_tw], + aGameArrays[lVarID].szLabel,index,m*aGameArrays[lVarID].plValues[index]); + break; + } + else + { + OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]); + break; + } */ break; } else if (*insptr&(MAXGAMEVARS<<1)) diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index 727f431ef..c22a9cc5a 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -4044,7 +4044,7 @@ static int32_t X_AccessSpriteX(int32_t iActor, int32_t lLabelID, int32_t lParm2) if ((ActorLabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= ActorLabels[lLabelID].maxParm2)) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "tried to get invalid %s position %d on sprite (%d) from spr %d\n", - g_errorLineNum,keyw[g_tw],ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); + g_errorLineNum,keyw[g_tw],ActorLabels[lLabelID].name,lParm2,iActor,vm.g_i); return -1; } @@ -4141,7 +4141,7 @@ static int32_t X_AccessPlayerX(int32_t iPlayer, int32_t lLabelID, int32_t lParm2 if ((PlayerLabels[lLabelID].flags & LABEL_HASPARM2 && (lParm2 < 0 || lParm2 >= PlayerLabels[lLabelID].maxParm2)) && g_scriptSanityChecks) { OSD_Printf(CON_ERROR "tried to %s invalid %s position %d on player (%d) from spr %d\n", - g_errorLineNum,keyw[g_tw],PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); + g_errorLineNum,keyw[g_tw],PlayerLabels[lLabelID].name,lParm2,iPlayer,vm.g_i); } switch (lLabelID) diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index ed7dccadc..d25387d27 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -163,7 +163,7 @@ char szPlayerName[32]; int32_t g_damageCameras,g_freezerSelfDamage=0,g_tripbombLaserMode=0; int32_t g_networkBroadcastMode = 255, g_movesPerPacket = 1,g_gameQuit = 0,everyothertime; int32_t g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius, - g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius; + g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius; STATUSBARTYPE sbar; int32_t mymaxlag, otherminlag, bufferjitter = 1; diff --git a/polymer/eduke32/source/macros.h b/polymer/eduke32/source/macros.h index 5dd1041ba..3a7a9464b 100644 --- a/polymer/eduke32/source/macros.h +++ b/polymer/eduke32/source/macros.h @@ -1,5 +1,7 @@ // Macros, some from SW source +#define GTFLAGS(x) (GametypeFlags[ud.coop] & x) + #define TRAVERSE_SPRITE_SECT(l, o, n) for ((o) = (l); (n) = nextspritesect[o], (o) != -1; (o) = (n)) #define TRAVERSE_SPRITE_STAT(l, o, n) for ((o) = (l); (n) = nextspritestat[o], (o) != -1; (o) = (n)) #define TRAVERSE_CONNECT(i) for (i = connecthead; i != -1; i = connectpoint2[i]) diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index a0588a4ec..58a5a0cd3 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -449,7 +449,7 @@ static int32_t osdcmd_restartvid(const osdfuncparm_t *parm) static int32_t osdcmd_vidmode(const osdfuncparm_t *parm) { int32_t newbpp = ud.config.ScreenBPP, newwidth = ud.config.ScreenWidth, - newheight = ud.config.ScreenHeight, newfs = ud.config.ScreenMode; + newheight = ud.config.ScreenHeight, newfs = ud.config.ScreenMode; if (parm->numparms < 1 || parm->numparms > 4) return OSDCMD_SHOWHELP; switch (parm->numparms) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 0a95d039f..5d0a403de 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -139,35 +139,39 @@ static void A_DoWaterTracers(int32_t x1,int32_t y1,int32_t z1,int32_t x2,int32_t } } -static void A_HitscanProjTrail(int32_t x1, int32_t y1, int32_t z1, int32_t x2, int32_t y2, int32_t z2, int32_t ang, int32_t atwith) +static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang, int32_t atwith) { int32_t n, j, i; int16_t sect = -1; + vec3_t srcvect; + vec3_t destvect; - x1 += (sintable[(348+ang+512)&2047]/ProjectileData[atwith].offset); - y1 += (sintable[(ang+348)&2047]/ProjectileData[atwith].offset); - z1 += 1024+(ProjectileData[atwith].toffset<<8); + Bmemcpy(&destvect,&dv,sizeof(vec3_t)); - n = ((FindDistance2D(x1-x2,y1-y2))>>8)+1; + srcvect.x = sv->x + (sintable[(348+ang+512)&2047]/ProjectileData[atwith].offset); + srcvect.y = sv->y + (sintable[(ang+348)&2047]/ProjectileData[atwith].offset); + srcvect.z = sv->z + 1024+(ProjectileData[atwith].toffset<<8); - x2 = ((x2-x1)/n); - y2 = ((y2-y1)/n); - z2 = ((z2-z1)/n); + n = ((FindDistance2D(srcvect.x-destvect.x,srcvect.y-destvect.y))>>8)+1; - x1 += x2>>2; - y1 += y2>>2; - z1 += (z2>>2); + destvect.x = ((destvect.x-srcvect.x)/n); + destvect.y = ((destvect.y-srcvect.y)/n); + destvect.z = ((destvect.z-srcvect.z)/n); + + srcvect.x += destvect.x>>2; + srcvect.y += destvect.y>>2; + srcvect.z += (destvect.z>>2); for (i=ProjectileData[atwith].tnum;i>0;i--) { - x1 += x2; - y1 += y2; - z1 += z2; - updatesector(x1,y1,§); - getzsofslope(sect,x1,y1,&n,&j); - if (sect < 0 || z1 > j || z1 < n) + srcvect.x += destvect.x; + srcvect.y += destvect.y; + srcvect.z += destvect.z; + updatesector(srcvect.x,srcvect.y,§); + getzsofslope(sect,srcvect.x,srcvect.y,&n,&j); + if (sect < 0 || srcvect.z > j || srcvect.z < n) break; - j = A_InsertSprite(sect,x1,y1,z1,ProjectileData[atwith].trail,-32,ProjectileData[atwith].txrepeat,ProjectileData[atwith].tyrepeat,ang,0,0,g_player[0].ps->i,0); + j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,ProjectileData[atwith].trail,-32,ProjectileData[atwith].txrepeat,ProjectileData[atwith].tyrepeat,ang,0,0,g_player[0].ps->i,0); changespritestat(j,1); } } @@ -301,7 +305,9 @@ static int32_t A_FindTargetSprite(spritetype *s,int32_t aang,int32_t atwith) int32_t A_Shoot(int32_t i,int32_t atwith) { int16_t hitsect, hitspr, hitwall, l, sa, p, j, k=-1, wh, scount; - int32_t sx, sy, sz, vel, zvel = 0, hitx, hity, hitz, x, oldzvel, dal; + int32_t vel, zvel = 0, x, oldzvel, dal; + vec3_t hitvect; + vec3_t srcvect; char sizx,sizy; spritetype *s = &sprite[i]; int16_t sect = s->sectnum; @@ -310,9 +316,9 @@ int32_t A_Shoot(int32_t i,int32_t atwith) { p = s->yvel; - sx = g_player[p].ps->posx; - sy = g_player[p].ps->posy; - sz = g_player[p].ps->posz+g_player[p].ps->pyoff+(4<<8); + srcvect.x = g_player[p].ps->posx; + srcvect.y = g_player[p].ps->posy; + srcvect.z = g_player[p].ps->posz+g_player[p].ps->pyoff+(4<<8); sa = g_player[p].ps->ang; g_player[p].ps->crack_time = 777; @@ -321,16 +327,16 @@ int32_t A_Shoot(int32_t i,int32_t atwith) { p = -1; sa = s->ang; - sx = s->x; - sy = s->y; - sz = s->z-((s->yrepeat*tilesizy[s->picnum])<<1)+(4<<8); + Bmemcpy(&srcvect,s,sizeof(int32_t) * 3); + srcvect.z -= ((s->yrepeat*tilesizy[s->picnum])<<1)+(4<<8); + if (s->picnum != ROTATEGUN) { - sz -= (7<<8); + srcvect.z -= (7<<8); if (A_CheckEnemySprite(s) && PN != COMMANDER) { - sx += (sintable[(sa+1024+96)&2047]>>7); - sy += (sintable[(sa+512+96)&2047]>>7); + srcvect.x += (sintable[(sa+1024+96)&2047]>>7); + srcvect.y += (sintable[(sa+512+96)&2047]>>7); } } } @@ -357,29 +363,29 @@ int32_t A_Shoot(int32_t i,int32_t atwith) if (p >= 0) { zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; - sz += (6<<8); + srcvect.z += (6<<8); sa += 15; } else if (!(ProjectileData[atwith].workslike & PROJECTILE_NOAIM)) { j = g_player[A_FindPlayer(s,&x)].ps->i; - zvel = ((sprite[j].z-sz)<<8) / (x+1); - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + zvel = ((sprite[j].z-srcvect.z)<<8) / (x+1); + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } } if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect, + hitscan(srcvect.x,srcvect.y,srcvect.z,sect, sintable[(sa+512)&2047], sintable[sa&2047],zvel<<6, - &hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + &hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD) { if (ProjectileData[atwith].range == 0) ProjectileData[atwith].range = 1024; - if (FindDistance2D(sx-hitx,sy-hity) < ProjectileData[atwith].range) + if (FindDistance2D(srcvect.x-hitvect.x,srcvect.y-hitvect.y) < ProjectileData[atwith].range) if (FindDistance2D(wall[hitwall].x-wall[wall[hitwall].point2].x,wall[hitwall].y-wall[wall[hitwall].point2].y) > (mulscale(ProjectileData[atwith].xrepeat+8,tilesizx[ProjectileData[atwith].decal],3))) if (hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE) if ((wall[hitwall].nextsector >= 0 && hitsect >= 0 && @@ -414,9 +420,9 @@ int32_t A_Shoot(int32_t i,int32_t atwith) sprite[k].xvel = -12; sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, wall[hitwall].y-wall[wall[hitwall].point2].y)+512; - sprite[k].x = hitx; - sprite[k].y = hity; - sprite[k].z = hitz; + sprite[k].x = hitvect.x; + sprite[k].y = hitvect.y; + sprite[k].z = hitvect.z; sprite[k].cstat |= (krand()&4); sprite[k].xrepeat = ProjectileData[atwith].xrepeat; sprite[k].yrepeat = ProjectileData[atwith].yrepeat; @@ -433,9 +439,9 @@ int32_t A_Shoot(int32_t i,int32_t atwith) sprite[k].xvel = -1; sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, wall[hitwall].y-wall[wall[hitwall].point2].y)+512; - sprite[k].x = hitx; - sprite[k].y = hity; - sprite[k].z = hitz; + sprite[k].x = hitvect.x; + sprite[k].y = hitvect.y; + sprite[k].z = hitvect.z; if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE) { wh = (krand()&ProjectileData[atwith].xrepeat); @@ -483,13 +489,13 @@ int32_t A_Shoot(int32_t i,int32_t atwith) if ((ProjectileData[atwith].range == 0) && (ProjectileData[atwith].workslike & PROJECTILE_KNEE)) ProjectileData[atwith].range = 1024; - if ((ProjectileData[atwith].range > 0) && ((klabs(sx-hitx)+klabs(sy-hity)) > ProjectileData[atwith].range)) + if ((ProjectileData[atwith].range > 0) && ((klabs(srcvect.x-hitvect.x)+klabs(srcvect.y-hitvect.y)) > ProjectileData[atwith].range)) return -1; else { if (hitwall >= 0 || hitspr >= 0) { - j = A_InsertSprite(hitsect,hitx,hity,hitz,atwith,-15,0,0,sa,32,0,i,4); + j = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,atwith,-15,0,0,sa,32,0,i,4); ActorExtra[j].projectile.workslike = ProjectileData[sprite[j].picnum].workslike; sprite[j].extra = ProjectileData[atwith].extra; if (ProjectileData[atwith].extra_rand > 0) @@ -520,12 +526,12 @@ int32_t A_Shoot(int32_t i,int32_t atwith) { if (wall[hitwall].cstat&2) if (wall[hitwall].nextsector >= 0) - if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + if (hitvect.z >= (sector[wall[hitwall].nextsector].floorz)) hitwall = wall[hitwall].nextwall; if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2) { - A_DamageWall(j,hitwall,hitx,hity,hitz,atwith); + A_DamageWall(j,hitwall,&hitvect,atwith); if (p >= 0) P_ActivateSwitch(p,hitwall,0); } } @@ -533,8 +539,8 @@ int32_t A_Shoot(int32_t i,int32_t atwith) else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { j = A_Spawn(g_player[p].ps->i,WATERSPLASH2); - sprite[j].x = hitx; - sprite[j].y = hity; + sprite[j].x = hitvect.x; + sprite[j].y = hitvect.y; sprite[j].ang = g_player[p].ps->ang; // Total tweek sprite[j].xvel = 32; A_SetSprite(i,CLIPMASK0); @@ -569,10 +575,10 @@ int32_t A_Shoot(int32_t i,int32_t atwith) dal -= (8<<8); // return -1; } - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) hitx++; - zvel = ((sprite[j].z-sz-dal)<<8) / hitx; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitvect.x == 0) hitvect.x++; + zvel = ((sprite[j].z-srcvect.z-dal)<<8) / hitvect.x; + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } Gv_SetVar(g_iAngRangeVarID,angRange, i,p); @@ -587,8 +593,8 @@ int32_t A_Shoot(int32_t i,int32_t atwith) { zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + hitscan(srcvect.x,srcvect.y,srcvect.z,sect,sintable[(sa+512)&2047],sintable[sa&2047], + zvel<<6,&hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); if (hitspr != -1) { if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13) @@ -613,16 +619,16 @@ int32_t A_Shoot(int32_t i,int32_t atwith) } zvel += (zRange/2)-(krand()&(zRange-1)); } - sz -= (2<<8); + srcvect.z -= (2<<8); } else { j = A_FindPlayer(s,&x); - sz -= (4<<8); - hitx = ldist(&sprite[g_player[j].ps->i], s); - if (hitx == 0) - hitx++; - zvel = ((g_player[j].ps->posz-sz) <<8) / hitx; + srcvect.z -= (4<<8); + hitvect.x = ldist(&sprite[g_player[j].ps->i], s); + if (hitvect.x == 0) + hitvect.x++; + zvel = ((g_player[j].ps->posz-srcvect.z) <<8) / hitvect.x; if (s->picnum != BOSS1) { zvel += 128-(krand()&255); @@ -631,7 +637,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith) else { zvel += 128-(krand()&255); - sa = getangle(g_player[j].ps->posx-sx,g_player[j].ps->posy-sy)+64-(krand()&127); + sa = getangle(g_player[j].ps->posx-srcvect.x,g_player[j].ps->posy-srcvect.y)+64-(krand()&127); } } @@ -639,10 +645,10 @@ int32_t A_Shoot(int32_t i,int32_t atwith) else s->cstat &= ~257; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect, + hitscan(srcvect.x,srcvect.y,srcvect.z,sect, sintable[(sa+512)&2047], sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + zvel<<6,&hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); if (ProjectileData[atwith].cstat >= 0) s->cstat |= ProjectileData[atwith].cstat; @@ -650,20 +656,28 @@ int32_t A_Shoot(int32_t i,int32_t atwith) if (hitsect < 0) return -1; - if ((ProjectileData[atwith].range > 0) && ((klabs(sx-hitx)+klabs(sy-hity)) > ProjectileData[atwith].range)) return -1; + if ((ProjectileData[atwith].range > 0) && + ((klabs(srcvect.x-hitvect.x)+klabs(srcvect.y-hitvect.y)) > ProjectileData[atwith].range)) + return -1; if (ProjectileData[atwith].trail >= 0) - A_HitscanProjTrail(sx,sy,sz,hitx,hity,hitz,sa,atwith); + { + vec3_t tmpvect; + vec3_t tmphvect; + Bmemcpy(&tmpvect,&srcvect,sizeof(vec3_t)); + Bmemcpy(&tmphvect,&hitvect,sizeof(vec3_t)); + A_HitscanProjTrail(&tmpvect,&tmphvect,sa,atwith); + } if (ProjectileData[atwith].workslike & PROJECTILE_WATERBUBBLES) { if ((krand()&15) == 0 && sector[hitsect].lotag == 2) - A_DoWaterTracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); + A_DoWaterTracers(hitvect.x,hitvect.y,hitvect.z,srcvect.x,srcvect.y,srcvect.z,8-(ud.multimode>>1)); } if (p >= 0) { - k = A_InsertSprite(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); + k = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,SHOTSPARK1,-15,10,10,sa,0,0,i,4); sprite[k].extra = ProjectileData[atwith].extra; if (ProjectileData[atwith].extra_rand > 0) sprite[k].extra += (krand()%ProjectileData[atwith].extra_rand); @@ -821,15 +835,15 @@ DOSKIPBULLETHOLE: if (wall[hitwall].cstat&2) if (wall[hitwall].nextsector >= 0) - if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + if (hitvect.z >= (sector[wall[hitwall].nextsector].floorz)) hitwall = wall[hitwall].nextwall; - A_DamageWall(k,hitwall,hitx,hity,hitz,atwith); + A_DamageWall(k,hitwall,&hitvect,atwith); } } else { - k = A_InsertSprite(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,24,24,sa,0,0,i,4); + k = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,SHOTSPARK1,-15,24,24,sa,0,0,i,4); sprite[k].extra = ProjectileData[atwith].extra; if (ProjectileData[atwith].extra_rand > 0) sprite[k].extra += (krand()%ProjectileData[atwith].extra_rand); @@ -856,12 +870,14 @@ DOSKIPBULLETHOLE: else sprite[k].xrepeat = sprite[k].yrepeat = 0; } else if (hitwall >= 0) - A_DamageWall(k,hitwall,hitx,hity,hitz,atwith); + A_DamageWall(k,hitwall,&hitvect,atwith); } if ((krand()&255) < 4) if (ProjectileData[atwith].isound >= 0) - S_PlaySoundXYZ(ProjectileData[atwith].isound,k,hitx,hity,hitz); + { + S_PlaySoundXYZ(ProjectileData[atwith].isound,k,&hitvect); + } return -1; } @@ -892,15 +908,15 @@ DOSKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) - hitx++; + if (hitvect.x == 0) + hitvect.x++; - zvel = ((sprite[j].z-sz-dal)*vel) / hitx; + zvel = ((sprite[j].z-srcvect.z-dal)*vel) / hitvect.x; if (sprite[j].picnum != RECON) - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } // else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*81; else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*(ProjectileData[atwith].vel/8); @@ -913,12 +929,12 @@ DOSKIPBULLETHOLE: if (!(ProjectileData[atwith].workslike & PROJECTILE_NOAIM)) { j = A_FindPlayer(s,&x); - sa = getangle(g_player[j].ps->oposx-sx,g_player[j].ps->oposy-sy); + sa = getangle(g_player[j].ps->oposx-srcvect.x,g_player[j].ps->oposy-srcvect.y); l = ldist(&sprite[g_player[j].ps->i],s); if (l == 0) l++; - zvel = ((g_player[j].ps->oposz-sz)*vel) / l; + zvel = ((g_player[j].ps->oposz-srcvect.z)*vel) / l; if (A_CheckEnemySprite(s) && (s->hitag&face_player_smart)) sa = s->ang+(krand()&31)-16; @@ -937,9 +953,9 @@ DOSKIPBULLETHOLE: sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4);*/ if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; j = A_InsertSprite(sect, - sx+(sintable[(348+sa+512)&2047]/ProjectileData[atwith].offset), - sy+(sintable[(sa+348)&2047]/ProjectileData[atwith].offset), - sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); + srcvect.x+(sintable[(348+sa+512)&2047]/ProjectileData[atwith].offset), + srcvect.y+(sintable[(sa+348)&2047]/ProjectileData[atwith].offset), + srcvect.z-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); sprite[j].xrepeat=ProjectileData[atwith].xrepeat; sprite[j].yrepeat=ProjectileData[atwith].yrepeat; @@ -1001,26 +1017,26 @@ DOSKIPBULLETHOLE: if (p >= 0) { zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; - sz += (6<<8); + srcvect.z += (6<<8); sa += 15; } else { j = g_player[A_FindPlayer(s,&x)].ps->i; - zvel = ((sprite[j].z-sz)<<8) / (x+1); - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + zvel = ((sprite[j].z-srcvect.z)<<8) / (x+1); + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } } if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect, + hitscan(srcvect.x,srcvect.y,srcvect.z,sect, sintable[(sa+512)&2047], sintable[sa&2047],zvel<<6, - &hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + &hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); if (atwith == BLOODSPLAT1 || atwith == BLOODSPLAT2 || atwith == BLOODSPLAT3 || atwith == BLOODSPLAT4) { - if (FindDistance2D(sx-hitx,sy-hity) < 1024) + if (FindDistance2D(srcvect.x-hitvect.x,srcvect.y-hitvect.y) < 1024) if (hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE) if ((wall[hitwall].nextsector >= 0 && hitsect >= 0 && sector[wall[hitwall].nextsector].lotag == 0 && @@ -1051,9 +1067,9 @@ DOSKIPBULLETHOLE: sprite[k].xvel = -12; sprite[k].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, wall[hitwall].y-wall[wall[hitwall].point2].y)+512; - sprite[k].x = hitx; - sprite[k].y = hity; - sprite[k].z = hitz; + sprite[k].x = hitvect.x; + sprite[k].y = hitvect.y; + sprite[k].z = hitvect.z; sprite[k].cstat |= (krand()&4); A_SetSprite(k,CLIPMASK0); setsprite(k,sprite[k].x,sprite[k].y,sprite[k].z); @@ -1066,11 +1082,11 @@ DOSKIPBULLETHOLE: if (hitsect < 0) break; - if ((klabs(sx-hitx)+klabs(sy-hity)) < 1024) + if ((klabs(srcvect.x-hitvect.x)+klabs(srcvect.y-hitvect.y)) < 1024) { if (hitwall >= 0 || hitspr >= 0) { - j = A_InsertSprite(hitsect,hitx,hity,hitz,KNEE,-15,0,0,sa,32,0,i,4); + j = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,KNEE,-15,0,0,sa,32,0,i,4); sprite[j].extra += (krand()&7); if (p >= 0) { @@ -1095,12 +1111,12 @@ DOSKIPBULLETHOLE: { if (wall[hitwall].cstat&2) if (wall[hitwall].nextsector >= 0) - if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + if (hitvect.z >= (sector[wall[hitwall].nextsector].floorz)) hitwall = wall[hitwall].nextwall; if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2) { - A_DamageWall(j,hitwall,hitx,hity,hitz,atwith); + A_DamageWall(j,hitwall,&hitvect,atwith); if (p >= 0) P_ActivateSwitch(p,hitwall,0); } } @@ -1108,8 +1124,8 @@ DOSKIPBULLETHOLE: else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { j = A_Spawn(g_player[p].ps->i,WATERSPLASH2); - sprite[j].x = hitx; - sprite[j].y = hity; + sprite[j].x = hitvect.x; + sprite[j].y = hitvect.y; sprite[j].ang = g_player[p].ps->ang; // Total tweek sprite[j].xvel = 32; A_SetSprite(i,CLIPMASK0); @@ -1147,10 +1163,10 @@ DOSKIPBULLETHOLE: dal -= (8<<8); } - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) hitx++; - zvel = ((sprite[j].z-sz-dal)<<8) / hitx; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitvect.x == 0) hitvect.x++; + zvel = ((sprite[j].z-srcvect.z-dal)<<8) / hitvect.x; + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } Gv_SetVar(g_iAngRangeVarID,angRange, i,p); @@ -1167,8 +1183,8 @@ DOSKIPBULLETHOLE: { zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)<<5; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect,sintable[(sa+512)&2047],sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + hitscan(srcvect.x,srcvect.y,srcvect.z,sect,sintable[(sa+512)&2047],sintable[sa&2047], + zvel<<6,&hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); if (hitspr != -1) { if (sprite[hitspr].statnum == 1 || sprite[hitspr].statnum == 2 || sprite[hitspr].statnum == 10 || sprite[hitspr].statnum == 13) @@ -1194,16 +1210,16 @@ DOSKIPBULLETHOLE: zvel += (zRange/2)-(krand()&(zRange-1)); } - sz -= (2<<8); + srcvect.z -= (2<<8); } else { j = A_FindPlayer(s,&x); - sz -= (4<<8); - hitx = ldist(&sprite[g_player[j].ps->i], s); - if (hitx == 0) - hitx++; - zvel = ((g_player[j].ps->posz-sz) <<8) / hitx; + srcvect.z -= (4<<8); + hitvect.x = ldist(&sprite[g_player[j].ps->i], s); + if (hitvect.x == 0) + hitvect.x++; + zvel = ((g_player[j].ps->posz-srcvect.z) <<8) / hitvect.x; if (s->picnum != BOSS1) { zvel += 128-(krand()&255); @@ -1212,26 +1228,27 @@ DOSKIPBULLETHOLE: else { zvel += 128-(krand()&255); - sa = getangle(g_player[j].ps->posx-sx,g_player[j].ps->posy-sy)+64-(krand()&127); + sa = getangle(g_player[j].ps->posx-srcvect.x,g_player[j].ps->posy-srcvect.y)+64-(krand()&127); } } s->cstat &= ~257; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect, + hitscan(srcvect.x,srcvect.y,srcvect.z,sect, sintable[(sa+512)&2047], sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + zvel<<6,&hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); s->cstat |= 257; if (hitsect < 0) return -1; if ((krand()&15) == 0 && sector[hitsect].lotag == 2) - A_DoWaterTracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); + A_DoWaterTracers(hitvect.x,hitvect.y,hitvect.z, + srcvect.x,srcvect.y,srcvect.z,8-(ud.multimode>>1)); if (p >= 0) { - k = A_InsertSprite(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); + k = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,SHOTSPARK1,-15,10,10,sa,0,0,i,4); sprite[k].extra = *actorscrptr[atwith]; sprite[k].extra += (krand()%6); sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 @@ -1346,9 +1363,9 @@ DOSKIPBULLETHOLE: } l = A_Spawn(k,BULLETHOLE); sprite[l].xvel = -1; - sprite[l].x = hitx; - sprite[l].y = hity; - sprite[l].z = hitz; + sprite[l].x = hitvect.x; + sprite[l].y = hitvect.y; + sprite[l].z = hitvect.z; sprite[l].ang = getangle(wall[hitwall].x-wall[wall[hitwall].point2].x, wall[hitwall].y-wall[wall[hitwall].point2].y)+512; @@ -1362,15 +1379,15 @@ SKIPBULLETHOLE: if (wall[hitwall].cstat&2) if (wall[hitwall].nextsector >= 0) - if (hitz >= (sector[wall[hitwall].nextsector].floorz)) + if (hitvect.z >= (sector[wall[hitwall].nextsector].floorz)) hitwall = wall[hitwall].nextwall; - A_DamageWall(k,hitwall,hitx,hity,hitz,SHOTSPARK1); + A_DamageWall(k,hitwall,&hitvect,SHOTSPARK1); } } else { - k = A_InsertSprite(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,24,24,sa,0,0,i,4); + k = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,SHOTSPARK1,-15,24,24,sa,0,0,i,4); sprite[k].extra = *actorscrptr[atwith]; sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 ActorExtra[k].temp_data[6] = hitwall; @@ -1390,11 +1407,11 @@ SKIPBULLETHOLE: else sprite[k].xrepeat = sprite[k].yrepeat = 0; } else if (hitwall >= 0) - A_DamageWall(k,hitwall,hitx,hity,hitz,SHOTSPARK1); + A_DamageWall(k,hitwall,&hitvect,SHOTSPARK1); } if ((krand()&255) < 4) - S_PlaySoundXYZ(PISTOL_RICOCHET,k,hitx,hity,hitz); + S_PlaySoundXYZ(PISTOL_RICOCHET,k, &hitvect); return -1; @@ -1412,12 +1429,12 @@ SKIPBULLETHOLE: { if (s->picnum == BOSS2) vel = 644; else vel = 348; - sz -= (4<<7); + srcvect.z -= (4<<7); } else { vel = 840; - sz -= (4<<7); + srcvect.z -= (4<<7); } } @@ -1435,10 +1452,10 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) hitx++; - zvel = ((sprite[j].z-sz-dal)*vel) / hitx; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitvect.x == 0) hitvect.x++; + zvel = ((sprite[j].z-srcvect.z-dal)*vel) / hitvect.x; + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*98; @@ -1448,9 +1465,9 @@ SKIPBULLETHOLE: j = A_FindPlayer(s,&x); // sa = getangle(g_player[j].ps->oposx-sx,g_player[j].ps->oposy-sy); sa += 16-(krand()&31); - hitx = ldist(&sprite[g_player[j].ps->i],s); - if (hitx == 0) hitx++; - zvel = ((g_player[j].ps->oposz - sz + (3<<8))*vel) / hitx; + hitvect.x = ldist(&sprite[g_player[j].ps->i],s); + if (hitvect.x == 0) hitvect.x++; + zvel = ((g_player[j].ps->oposz - srcvect.z + (3<<8))*vel) / hitvect.x; } if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; oldzvel = zvel; @@ -1458,7 +1475,7 @@ SKIPBULLETHOLE: if (atwith == SPIT) { sizx = 18; - sizy = 18,sz -= (10<<8); + sizy = 18,srcvect.z -= (10<<8); } else { @@ -1487,7 +1504,8 @@ SKIPBULLETHOLE: while (scount > 0) { - j = A_InsertSprite(sect,sx,sy,sz,atwith,-127,sizx,sizy,sa,vel,zvel,i,4); + j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z, + atwith,-127,sizx,sizy,sa,vel,zvel,i,4); sprite[j].extra += (krand()&7); if (atwith == COOLEXPLOSION1) @@ -1515,7 +1533,7 @@ SKIPBULLETHOLE: return j; case FREEZEBLAST__STATIC: - sz += (3<<8); + srcvect.z += (3<<8); case RPG__STATIC: if (s->extra >= 0) s->shade = -96; @@ -1539,11 +1557,11 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) hitx++; - zvel = ((sprite[j].z-sz-dal)*vel) / hitx; + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitvect.x == 0) hitvect.x++; + zvel = ((sprite[j].z-srcvect.z-dal)*vel) / hitvect.x; if (sprite[j].picnum != RECON) - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*81; if (atwith == RPG) @@ -1552,19 +1570,19 @@ SKIPBULLETHOLE: else { j = A_FindPlayer(s,&x); - sa = getangle(g_player[j].ps->oposx-sx,g_player[j].ps->oposy-sy); + sa = getangle(g_player[j].ps->oposx-srcvect.x,g_player[j].ps->oposy-srcvect.y); if (PN == BOSS3) - sz -= (32<<8); + srcvect.z -= (32<<8); else if (PN == BOSS2) { vel += 128; - sz += 24<<8; + srcvect.z += 24<<8; } l = ldist(&sprite[g_player[j].ps->i],s); if (l == 0) l++; - zvel = ((g_player[j].ps->oposz-sz)*vel) / l; + zvel = ((g_player[j].ps->oposz-srcvect.z)*vel) / l; if (A_CheckEnemySprite(s) && (s->hitag&face_player_smart)) sa = s->ang+(krand()&31)-16; @@ -1575,9 +1593,9 @@ SKIPBULLETHOLE: else l = -1; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; j = A_InsertSprite(sect, - sx+(sintable[(348+sa+512)&2047]/448), - sy+(sintable[(sa+348)&2047]/448), - sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); + srcvect.x+(sintable[(348+sa+512)&2047]/448), + srcvect.y+(sintable[(sa+348)&2047]/448), + srcvect.z-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4); sprite[j].extra += (krand()&7); if (atwith != FREEZEBLAST) @@ -1659,16 +1677,16 @@ SKIPBULLETHOLE: zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*32; else zvel = 0; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz-g_player[p].ps->pyoff,sect, + hitscan(srcvect.x,srcvect.y,srcvect.z-g_player[p].ps->pyoff,sect, sintable[(sa+512)&2047], sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + zvel<<6,&hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); j = 0; if (hitspr >= 0) break; if (hitwall >= 0 && hitsect >= 0) - if (((hitx-sx)*(hitx-sx)+(hity-sy)*(hity-sy)) < (290*290)) + if (((hitvect.x-srcvect.x)*(hitvect.x-srcvect.x)+(hitvect.y-srcvect.y)*(hitvect.y-srcvect.y)) < (290*290)) { if (wall[hitwall].nextsector >= 0) { @@ -1682,7 +1700,7 @@ SKIPBULLETHOLE: if (j == 1) { int32_t lTripBombControl=Gv_GetVarByLabel("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, g_player[p].ps->i, p); - k = A_InsertSprite(hitsect,hitx,hity,hitz,TRIPBOMB,-16,4,5,sa,0,0,i,6); + k = A_InsertSprite(hitsect,hitvect.x,hitvect.y,hitvect.z,TRIPBOMB,-16,4,5,sa,0,0,i,6); if (lTripBombControl & TRIPBOMB_TIMER) { int32_t lLifetime=Gv_GetVarByLabel("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, g_player[p].ps->i, p); @@ -1721,9 +1739,9 @@ SKIPBULLETHOLE: vel = x>>4; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; A_InsertSprite(sect, - sx+(sintable[(512+sa+512)&2047]>>8), - sy+(sintable[(sa+512)&2047]>>8), - sz+(6<<8),atwith,-64,32,32,sa,vel,zvel,i,1); + srcvect.x+(sintable[(512+sa+512)&2047]>>8), + srcvect.y+(sintable[(sa+512)&2047]>>8), + srcvect.z+(6<<8),atwith,-64,32,32,sa,vel,zvel,i,1); break; case GROWSPARK__STATIC: @@ -1747,11 +1765,11 @@ SKIPBULLETHOLE: dal -= (8<<8); } - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) - hitx++; - zvel = ((sprite[j].z-sz-dal)<<8) / hitx; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitvect.x == 0) + hitvect.x++; + zvel = ((sprite[j].z-srcvect.z-dal)<<8) / hitvect.x; + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } else { @@ -1760,16 +1778,16 @@ SKIPBULLETHOLE: zvel += 128-(krand()&255); } - sz -= (2<<8); + srcvect.z -= (2<<8); } else { j = A_FindPlayer(s,&x); - sz -= (4<<8); - hitx = ldist(&sprite[g_player[j].ps->i], s); - if (hitx == 0) - hitx++; - zvel = ((g_player[j].ps->posz-sz) <<8) / hitx; + srcvect.z -= (4<<8); + hitvect.x = ldist(&sprite[g_player[j].ps->i], s); + if (hitvect.x == 0) + hitvect.x++; + zvel = ((g_player[j].ps->posz-srcvect.z) <<8) / hitvect.x; zvel += 128-(krand()&255); sa += 32-(krand()&63); } @@ -1781,14 +1799,14 @@ SKIPBULLETHOLE: s->cstat &= ~257; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; - hitscan(sx,sy,sz,sect, + hitscan(srcvect.x,srcvect.y,srcvect.z,sect, sintable[(sa+512)&2047], sintable[sa&2047], - zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); + zvel<<6,&hitsect,&hitwall,&hitspr,&hitvect.x,&hitvect.y,&hitvect.z,CLIPMASK1); s->cstat |= 257; - j = A_InsertSprite(sect,hitx,hity,hitz,GROWSPARK,-16,28,28,sa,0,0,i,1); + j = A_InsertSprite(sect,hitvect.x,hitvect.y,hitvect.z,GROWSPARK,-16,28,28,sa,0,0,i,1); sprite[j].pal = 2; sprite[j].cstat |= 130; @@ -1808,9 +1826,9 @@ SKIPBULLETHOLE: wall[wall[hitwall].point2].x-wall[hitwall].x, wall[wall[hitwall].point2].y-wall[hitwall].y); - sx = hitx; - sy = hity; - sz = hitz; + sx = hitvect.x; + sy = hitvect.y; + srcvect.z = hitvect.z; sect = hitsect; sa = ((l<<1) - sa)&2047; sx += sintable[(sa+512)&2047]>>12; @@ -1820,7 +1838,7 @@ SKIPBULLETHOLE: goto RESHOOTGROW; } else */ - A_DamageWall(j,hitwall,hitx,hity,hitz,atwith); + A_DamageWall(j,hitwall,&hitvect,atwith); } break; @@ -1841,11 +1859,11 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1); - hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); - if (hitx == 0) - hitx++; - zvel = ((sprite[j].z-sz-dal-(4<<8))*768) / hitx; - sa = getangle(sprite[j].x-sx,sprite[j].y-sy); + hitvect.x = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitvect.x == 0) + hitvect.x++; + zvel = ((sprite[j].z-srcvect.z-dal-(4<<8))*768) / hitvect.x; + sa = getangle(sprite[j].x-srcvect.x,sprite[j].y-srcvect.y); } else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*98; } @@ -1855,14 +1873,14 @@ SKIPBULLETHOLE: l = ldist(&sprite[g_player[j].ps->i],s); if (l == 0) l++; - zvel = ((g_player[j].ps->oposz-sz)*512) / l ; + zvel = ((g_player[j].ps->oposz-srcvect.z)*512) / l ; } else zvel = 0; if (ActorExtra[i].temp_data[9]) zvel = ActorExtra[i].temp_data[9]; j = A_InsertSprite(sect, - sx+(sintable[(512+sa+512)&2047]>>12), - sy+(sintable[(sa+512)&2047]>>12), - sz+(2<<8),SHRINKSPARK,-16,28,28,sa,768,zvel,i,4); + srcvect.x+(sintable[(512+sa+512)&2047]>>12), + srcvect.y+(sintable[(sa+512)&2047]>>12), + srcvect.z+(2<<8),SHRINKSPARK,-16,28,28,sa,768,zvel,i,4); sprite[j].cstat = 128; sprite[j].clipdist = 32; @@ -3367,7 +3385,7 @@ static int32_t P_DoCounters(DukePlayer_t *p) int16_t WeaponPickupSprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATIC, SHOTGUNSPRITE__STATIC, CHAINGUNSPRITE__STATIC, RPGSPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC, DEVISTATORSPRITE__STATIC, TRIPBOMBSPRITE__STATIC, FREEZESPRITE__STATIC, HEAVYHBOMB__STATIC, SHRINKERSPRITE__STATIC - }; + }; // this is used for player deaths void P_DropWeapon(DukePlayer_t *p) { diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index e343af3f1..619f2028e 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -1144,7 +1144,7 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype) { int32_t switchpal, switchpicnum; int32_t i, x, lotag,hitag,picnum,correctdips = 1, numdips = 0; - int32_t sx,sy; + vec3_t davector; if (w < 0) return 0; @@ -1153,8 +1153,10 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype) lotag = sprite[w].lotag; if (lotag == 0) return 0; hitag = sprite[w].hitag; - sx = sprite[w].x; - sy = sprite[w].y; + +// sx = sprite[w].x; +// sy = sprite[w].y; + Bmemcpy(&davector, &sprite[w], sizeof(int32_t) * 3); picnum = sprite[w].picnum; switchpal = sprite[w].pal; } @@ -1163,8 +1165,10 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype) lotag = wall[w].lotag; if (lotag == 0) return 0; hitag = wall[w].hitag; - sx = wall[w].x; - sy = wall[w].y; + // sx = wall[w].x; + // sy = wall[w].y; + Bmemcpy(&davector, &wall[w], sizeof(int32_t) * 2); + davector.z = g_player[snum].ps->posz; picnum = wall[w].picnum; switchpal = wall[w].pal; } @@ -1488,17 +1492,17 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype) if (picnum == ALIENSWITCH || picnum == ALIENSWITCH+1) { if (switchtype == 1) - S_PlaySoundXYZ(ALIEN_SWITCH1,w,sx,sy,g_player[snum].ps->posz); - else S_PlaySoundXYZ(ALIEN_SWITCH1,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz); + S_PlaySoundXYZ(ALIEN_SWITCH1, w, &davector); + else S_PlaySoundXYZ(ALIEN_SWITCH1,g_player[snum].ps->i,&davector); } else { if (switchtype == 1) - S_PlaySoundXYZ(SWITCH_ON,w,sx,sy,g_player[snum].ps->posz); - else S_PlaySoundXYZ(SWITCH_ON,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz); + S_PlaySoundXYZ(SWITCH_ON, w, &davector); + else S_PlaySoundXYZ(SWITCH_ON,g_player[snum].ps->i,&davector); } if (numdips != correctdips) break; - S_PlaySoundXYZ(END_OF_LEVEL_WARN,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz); + S_PlaySoundXYZ(END_OF_LEVEL_WARN,g_player[snum].ps->i,&davector); } case DIPSWITCH2__STATIC: //case DIPSWITCH2+1: @@ -1578,13 +1582,13 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype) if (hitag == 0 && CheckDoorTile(picnum) == 0) { if (switchtype == 1) - S_PlaySoundXYZ(SWITCH_ON,w,sx,sy,g_player[snum].ps->posz); - else S_PlaySoundXYZ(SWITCH_ON,g_player[snum].ps->i,sx,sy,g_player[snum].ps->posz); + S_PlaySoundXYZ(SWITCH_ON,w,&davector); + else S_PlaySoundXYZ(SWITCH_ON,g_player[snum].ps->i,&davector); } else if (hitag != 0) { if (switchtype == 1 && (g_sounds[hitag].m&4) == 0) - S_PlaySoundXYZ(hitag,w,sx,sy,g_player[snum].ps->posz); + S_PlaySoundXYZ(hitag,w,&davector); else A_PlaySound(hitag,g_player[snum].ps->i); } @@ -1622,7 +1626,7 @@ static void BreakWall(int32_t newpn,int32_t spr,int32_t dawallnum) A_SpawnWallGlass(spr,dawallnum,10); } -void A_DamageWall(int32_t spr,int32_t dawallnum,int32_t x,int32_t y,int32_t z,int32_t atwith) +void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith) { int16_t sn = -1; int32_t j, i, darkestwall; @@ -1663,7 +1667,7 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,int32_t x,int32_t y,int32_t z,in } if (((wal->cstat&16) || wal->overpicnum == BIGFORCE) && wal->nextsector >= 0) - if (sector[wal->nextsector].floorz > z) + if (sector[wal->nextsector].floorz > pos->z) if (sector[wal->nextsector].floorz-sector[wal->nextsector].ceilingz) { int32_t switchpicnum = wal->overpicnum; @@ -1676,16 +1680,16 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,int32_t x,int32_t y,int32_t z,in //case W_FORCEFIELD+2: wal->extra = 1; // tell the forces to animate case BIGFORCE__STATIC: - updatesector(x,y,&sn); + updatesector(pos->x,pos->y,&sn); if (sn < 0) return; if (atwith == -1) - i = A_InsertSprite(sn,x,y,z,FORCERIPPLE,-127,8,8,0,0,0,spr,5); + i = A_InsertSprite(sn,pos->x,pos->y,pos->z,FORCERIPPLE,-127,8,8,0,0,0,spr,5); else { if (atwith == CHAINGUN) - i = A_InsertSprite(sn,x,y,z,FORCERIPPLE,-127,16+sprite[spr].xrepeat,16+sprite[spr].yrepeat,0,0,0,spr,5); - else i = A_InsertSprite(sn,x,y,z,FORCERIPPLE,-127,32,32,0,0,0,spr,5); + i = A_InsertSprite(sn,pos->x,pos->y,pos->z,FORCERIPPLE,-127,16+sprite[spr].xrepeat,16+sprite[spr].yrepeat,0,0,0,spr,5); + else i = A_InsertSprite(sn,pos->x,pos->y,pos->z,FORCERIPPLE,-127,32,32,0,0,0,spr,5); } CS |= 18+128; @@ -1709,7 +1713,7 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,int32_t x,int32_t y,int32_t z,in return; case GLASS__STATIC: - updatesector(x,y,&sn); + updatesector(pos->x,pos->y,&sn); if (sn < 0) return; wal->overpicnum=GLASS2; A_SpawnWallGlass(spr,dawallnum,10); @@ -1718,14 +1722,14 @@ void A_DamageWall(int32_t spr,int32_t dawallnum,int32_t x,int32_t y,int32_t z,in if (wal->nextwall >= 0) wall[wal->nextwall].cstat = 0; - i = A_InsertSprite(sn,x,y,z,SECTOREFFECTOR,0,0,0,g_player[0].ps->ang,0,0,spr,3); + i = A_InsertSprite(sn,pos->x,pos->y,pos->z,SECTOREFFECTOR,0,0,0,g_player[0].ps->ang,0,0,spr,3); SLT = 128; T2 = 5; T3 = dawallnum; A_PlaySound(GLASS_BREAKING,i); return; case STAINGLASS1__STATIC: - updatesector(x,y,&sn); + updatesector(pos->x,pos->y,&sn); if (sn < 0) return; A_SpawnRandomGlass(spr,dawallnum,80); wal->cstat = 0; @@ -1935,19 +1939,27 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j) p->posyv = -(sintable[(p->ang)&2047]<<8); A_PlaySound(DUKE_LONGTERM_PAIN,p->i); - A_DamageWall(p->i,j, - p->posx+(sintable[(p->ang+512)&2047]>>9), - p->posy+(sintable[p->ang&2047]>>9), - p->posz,-1); + { + vec3_t davect; + + davect.x = p->posx+(sintable[(p->ang+512)&2047]>>9); + davect.y = p->posy+(sintable[p->ang&2047]>>9); + davect.z = p->posz; + A_DamageWall(p->i,j,&davect,-1); + } break; case BIGFORCE__STATIC: p->hurt_delay = 26; - A_DamageWall(p->i,j, - p->posx+(sintable[(p->ang+512)&2047]>>9), - p->posy+(sintable[p->ang&2047]>>9), - p->posz,-1); + { + vec3_t davect; + + davect.x = p->posx+(sintable[(p->ang+512)&2047]>>9); + davect.y = p->posy+(sintable[p->ang&2047]>>9); + davect.z = p->posz; + A_DamageWall(p->i,j,&davect,-1); + } break; } diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 81e1f5c36..970b8ae78 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -267,7 +267,7 @@ int32_t S_LoadSound(uint32_t num) return 1; } -int32_t S_PlaySoundXYZ(int32_t num,int32_t i,int32_t x,int32_t y,int32_t z) +int32_t S_PlaySoundXYZ(int32_t num, int32_t i, const vec3_t *pos) { int32_t sndist, cx, cy, cz, j,k; int32_t pitche,pitchs,cs; @@ -311,7 +311,7 @@ int32_t S_PlaySoundXYZ(int32_t num,int32_t i,int32_t x,int32_t y,int32_t z) cs = g_player[screenpeek].ps->cursectnum; ca = g_player[screenpeek].ps->ang+g_player[screenpeek].ps->look_ang; - sndist = FindDistance3D((cx-x),(cy-y),(cz-z)>>4); + sndist = FindDistance3D((cx-pos->x),(cy-pos->y),(cz-pos->z)>>4); if (i >= 0 && (g_sounds[num].m&16) == 0 && PN == MUSICANDSFX && SLT < 999 && (sector[SECT].lotag&0xff) < 9) sndist = divscale14(sndist,(SHT+1)); @@ -367,7 +367,7 @@ int32_t S_PlaySoundXYZ(int32_t num,int32_t i,int32_t x,int32_t y,int32_t z) } else { - sndang = 2048 + ca - getangle(cx-x,cy-y); + sndang = 2048 + ca - getangle(cx-pos->x,cy-pos->y); sndang &= 2047; } @@ -512,7 +512,12 @@ int32_t A_PlaySound(uint32_t num, int32_t i) S_PlaySound(num); return 0; } - return S_PlaySoundXYZ(num,i,SX,SY,SZ); + { + vec3_t davector; + Bmemcpy(&davector,&sprite[i],sizeof(intptr_t) * 3); +// OSD_Printf("x: %d y: %d z: %d\n",davector.x,davector.y,davector.z); + return S_PlaySoundXYZ(num,i, &davector); + } } void A_StopSound(int32_t num, int32_t i)