Fix demo playback with diff application enabled.

This requires ripping out the .proj member of tiledata_t back into
ProjectileData[] again because it was the only one in g_tile[] that
changed during the course of a game.  The g_tile[] array is now also
correctly flagged as "constant throughout a game" (DS_NOCHK).
Savegame version bumped.

git-svn-id: https://svn.eduke32.com/eduke32@3151 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-11-11 17:57:06 +00:00
parent ed9fa753f1
commit a76a796ebb
8 changed files with 195 additions and 193 deletions

View file

@ -174,8 +174,7 @@ typedef struct {
int16_t cacherange[2]; // formerly SpriteCache
// todo: make these pointers and allocate at runtime
projectile_t proj;
// todo: make this a pointer and allocate at runtime
projectile_t defproj;
} tiledata_t;

View file

@ -57,7 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VOLUMEONE (g_Shareware == 1)
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION_JF 252
#define BYTEVERSION_JF 255
#define BYTEVERSION_13 27
#define BYTEVERSION_14 116

View file

@ -4020,61 +4020,61 @@ static int32_t C_ParseCommand(int32_t loop)
switch (y)
{
case PROJ_WORKSLIKE:
g_tile[j].defproj.workslike = g_tile[j].proj.workslike = z; break;
g_tile[j].defproj.workslike = ProjectileData[j].workslike = z; break;
case PROJ_SPAWNS:
g_tile[j].defproj.spawns = g_tile[j].proj.spawns = z; break;
g_tile[j].defproj.spawns = ProjectileData[j].spawns = z; break;
case PROJ_SXREPEAT:
g_tile[j].defproj.sxrepeat = g_tile[j].proj.sxrepeat = z; break;
g_tile[j].defproj.sxrepeat = ProjectileData[j].sxrepeat = z; break;
case PROJ_SYREPEAT:
g_tile[j].defproj.syrepeat = g_tile[j].proj.syrepeat = z; break;
g_tile[j].defproj.syrepeat = ProjectileData[j].syrepeat = z; break;
case PROJ_SOUND:
g_tile[j].defproj.sound = g_tile[j].proj.sound = z; break;
g_tile[j].defproj.sound = ProjectileData[j].sound = z; break;
case PROJ_ISOUND:
g_tile[j].defproj.isound = g_tile[j].proj.isound = z; break;
g_tile[j].defproj.isound = ProjectileData[j].isound = z; break;
case PROJ_VEL:
g_tile[j].defproj.vel = g_tile[j].proj.vel = z; break;
g_tile[j].defproj.vel = ProjectileData[j].vel = z; break;
case PROJ_EXTRA:
g_tile[j].defproj.extra = g_tile[j].proj.extra = z; break;
g_tile[j].defproj.extra = ProjectileData[j].extra = z; break;
case PROJ_DECAL:
g_tile[j].defproj.decal = g_tile[j].proj.decal = z; break;
g_tile[j].defproj.decal = ProjectileData[j].decal = z; break;
case PROJ_TRAIL:
g_tile[j].defproj.trail = g_tile[j].proj.trail = z; break;
g_tile[j].defproj.trail = ProjectileData[j].trail = z; break;
case PROJ_TXREPEAT:
g_tile[j].defproj.txrepeat = g_tile[j].proj.txrepeat = z; break;
g_tile[j].defproj.txrepeat = ProjectileData[j].txrepeat = z; break;
case PROJ_TYREPEAT:
g_tile[j].defproj.tyrepeat = g_tile[j].proj.tyrepeat = z; break;
g_tile[j].defproj.tyrepeat = ProjectileData[j].tyrepeat = z; break;
case PROJ_TOFFSET:
g_tile[j].defproj.toffset = g_tile[j].proj.toffset = z; break;
g_tile[j].defproj.toffset = ProjectileData[j].toffset = z; break;
case PROJ_TNUM:
g_tile[j].defproj.tnum = g_tile[j].proj.tnum = z; break;
g_tile[j].defproj.tnum = ProjectileData[j].tnum = z; break;
case PROJ_DROP:
g_tile[j].defproj.drop = g_tile[j].proj.drop = z; break;
g_tile[j].defproj.drop = ProjectileData[j].drop = z; break;
case PROJ_CSTAT:
g_tile[j].defproj.cstat = g_tile[j].proj.cstat = z; break;
g_tile[j].defproj.cstat = ProjectileData[j].cstat = z; break;
case PROJ_CLIPDIST:
g_tile[j].defproj.clipdist = g_tile[j].proj.clipdist = z; break;
g_tile[j].defproj.clipdist = ProjectileData[j].clipdist = z; break;
case PROJ_SHADE:
g_tile[j].defproj.shade = g_tile[j].proj.shade = z; break;
g_tile[j].defproj.shade = ProjectileData[j].shade = z; break;
case PROJ_XREPEAT:
g_tile[j].defproj.xrepeat = g_tile[j].proj.xrepeat = z; break;
g_tile[j].defproj.xrepeat = ProjectileData[j].xrepeat = z; break;
case PROJ_YREPEAT:
g_tile[j].defproj.yrepeat = g_tile[j].proj.yrepeat = z; break;
g_tile[j].defproj.yrepeat = ProjectileData[j].yrepeat = z; break;
case PROJ_PAL:
g_tile[j].defproj.pal = g_tile[j].proj.pal = z; break;
g_tile[j].defproj.pal = ProjectileData[j].pal = z; break;
case PROJ_EXTRA_RAND:
g_tile[j].defproj.extra_rand = g_tile[j].proj.extra_rand = z; break;
g_tile[j].defproj.extra_rand = ProjectileData[j].extra_rand = z; break;
case PROJ_HITRADIUS:
g_tile[j].defproj.hitradius = g_tile[j].proj.hitradius = z; break;
g_tile[j].defproj.hitradius = ProjectileData[j].hitradius = z; break;
case PROJ_MOVECNT:
g_tile[j].defproj.movecnt = g_tile[j].proj.movecnt = z; break;
g_tile[j].defproj.movecnt = ProjectileData[j].movecnt = z; break;
case PROJ_OFFSET:
g_tile[j].defproj.offset = g_tile[j].proj.offset = z; break;
g_tile[j].defproj.offset = ProjectileData[j].offset = z; break;
case PROJ_BOUNCES:
g_tile[j].defproj.bounces = g_tile[j].proj.bounces = z; break;
g_tile[j].defproj.bounces = ProjectileData[j].bounces = z; break;
case PROJ_BSOUND:
g_tile[j].defproj.bsound = g_tile[j].proj.bsound = z; break;
g_tile[j].defproj.bsound = ProjectileData[j].bsound = z; break;
case PROJ_RANGE:
g_tile[j].defproj.range = g_tile[j].proj.range = z; break;
g_tile[j].defproj.range = ProjectileData[j].range = z; break;
default: break;
}
@ -5826,8 +5826,8 @@ static void C_InitProjectiles(void)
for (i=MAXTILES-1; i>=0; i--)
{
Bmemcpy(&g_tile[i].proj, &DefaultProjectile, sizeof(projectile_t));
Bmemcpy(&g_tile[i].defproj, &g_tile[i].proj, sizeof(projectile_t));
Bmemcpy(&ProjectileData[i], &DefaultProjectile, sizeof(projectile_t));
Bmemcpy(&g_tile[i].defproj, &DefaultProjectile, sizeof(projectile_t));
}
}
#pragma pack(pop)

View file

@ -3143,253 +3143,253 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t
case PROJ_WORKSLIKE:
if (iSet)
{
g_tile[lVar1].proj.workslike=lValue;
ProjectileData[lVar1].workslike=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.workslike);
Gv_SetVarX(lVar2, ProjectileData[lVar1].workslike);
return;
case PROJ_SPAWNS:
if (iSet)
{
g_tile[lVar1].proj.spawns=lValue;
ProjectileData[lVar1].spawns=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.spawns);
Gv_SetVarX(lVar2, ProjectileData[lVar1].spawns);
return;
case PROJ_SXREPEAT:
if (iSet)
{
g_tile[lVar1].proj.sxrepeat=lValue;
ProjectileData[lVar1].sxrepeat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.sxrepeat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].sxrepeat);
return;
case PROJ_SYREPEAT:
if (iSet)
{
g_tile[lVar1].proj.syrepeat=lValue;
ProjectileData[lVar1].syrepeat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.syrepeat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].syrepeat);
return;
case PROJ_SOUND:
if (iSet)
{
g_tile[lVar1].proj.sound=lValue;
ProjectileData[lVar1].sound=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.sound);
Gv_SetVarX(lVar2, ProjectileData[lVar1].sound);
return;
case PROJ_ISOUND:
if (iSet)
{
g_tile[lVar1].proj.isound=lValue;
ProjectileData[lVar1].isound=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.isound);
Gv_SetVarX(lVar2, ProjectileData[lVar1].isound);
return;
case PROJ_VEL:
if (iSet)
{
g_tile[lVar1].proj.vel=lValue;
ProjectileData[lVar1].vel=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.vel);
Gv_SetVarX(lVar2, ProjectileData[lVar1].vel);
return;
case PROJ_EXTRA:
if (iSet)
{
g_tile[lVar1].proj.extra=lValue;
ProjectileData[lVar1].extra=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.extra);
Gv_SetVarX(lVar2, ProjectileData[lVar1].extra);
return;
case PROJ_DECAL:
if (iSet)
{
g_tile[lVar1].proj.decal=lValue;
ProjectileData[lVar1].decal=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.decal);
Gv_SetVarX(lVar2, ProjectileData[lVar1].decal);
return;
case PROJ_TRAIL:
if (iSet)
{
g_tile[lVar1].proj.trail=lValue;
ProjectileData[lVar1].trail=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.trail);
Gv_SetVarX(lVar2, ProjectileData[lVar1].trail);
return;
case PROJ_TXREPEAT:
if (iSet)
{
g_tile[lVar1].proj.txrepeat=lValue;
ProjectileData[lVar1].txrepeat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.txrepeat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].txrepeat);
return;
case PROJ_TYREPEAT:
if (iSet)
{
g_tile[lVar1].proj.tyrepeat=lValue;
ProjectileData[lVar1].tyrepeat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.tyrepeat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].tyrepeat);
return;
case PROJ_TOFFSET:
if (iSet)
{
g_tile[lVar1].proj.toffset=lValue;
ProjectileData[lVar1].toffset=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.toffset);
Gv_SetVarX(lVar2, ProjectileData[lVar1].toffset);
return;
case PROJ_TNUM:
if (iSet)
{
g_tile[lVar1].proj.tnum=lValue;
ProjectileData[lVar1].tnum=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.tnum);
Gv_SetVarX(lVar2, ProjectileData[lVar1].tnum);
return;
case PROJ_DROP:
if (iSet)
{
g_tile[lVar1].proj.drop=lValue;
ProjectileData[lVar1].drop=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.drop);
Gv_SetVarX(lVar2, ProjectileData[lVar1].drop);
return;
case PROJ_CSTAT:
if (iSet)
{
g_tile[lVar1].proj.cstat=lValue;
ProjectileData[lVar1].cstat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.cstat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].cstat);
return;
case PROJ_CLIPDIST:
if (iSet)
{
g_tile[lVar1].proj.clipdist=lValue;
ProjectileData[lVar1].clipdist=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.clipdist);
Gv_SetVarX(lVar2, ProjectileData[lVar1].clipdist);
return;
case PROJ_SHADE:
if (iSet)
{
g_tile[lVar1].proj.shade=lValue;
ProjectileData[lVar1].shade=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.shade);
Gv_SetVarX(lVar2, ProjectileData[lVar1].shade);
return;
case PROJ_XREPEAT:
if (iSet)
{
g_tile[lVar1].proj.xrepeat=lValue;
ProjectileData[lVar1].xrepeat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.xrepeat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].xrepeat);
return;
case PROJ_YREPEAT:
if (iSet)
{
g_tile[lVar1].proj.yrepeat=lValue;
ProjectileData[lVar1].yrepeat=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.yrepeat);
Gv_SetVarX(lVar2, ProjectileData[lVar1].yrepeat);
return;
case PROJ_PAL:
if (iSet)
{
g_tile[lVar1].proj.pal=lValue;
ProjectileData[lVar1].pal=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.pal);
Gv_SetVarX(lVar2, ProjectileData[lVar1].pal);
return;
case PROJ_EXTRA_RAND:
if (iSet)
{
g_tile[lVar1].proj.extra_rand=lValue;
ProjectileData[lVar1].extra_rand=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.extra_rand);
Gv_SetVarX(lVar2, ProjectileData[lVar1].extra_rand);
return;
case PROJ_HITRADIUS:
if (iSet)
{
g_tile[lVar1].proj.hitradius=lValue;
ProjectileData[lVar1].hitradius=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.hitradius);
Gv_SetVarX(lVar2, ProjectileData[lVar1].hitradius);
return;
case PROJ_MOVECNT:
if (iSet)
{
g_tile[lVar1].proj.movecnt=lValue;
ProjectileData[lVar1].movecnt=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.movecnt);
Gv_SetVarX(lVar2, ProjectileData[lVar1].movecnt);
return;
case PROJ_OFFSET:
if (iSet)
{
g_tile[lVar1].proj.offset=lValue;
ProjectileData[lVar1].offset=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.offset);
Gv_SetVarX(lVar2, ProjectileData[lVar1].offset);
return;
case PROJ_BOUNCES:
if (iSet)
{
g_tile[lVar1].proj.bounces=lValue;
ProjectileData[lVar1].bounces=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.bounces);
Gv_SetVarX(lVar2, ProjectileData[lVar1].bounces);
return;
case PROJ_BSOUND:
if (iSet)
{
g_tile[lVar1].proj.bsound=lValue;
ProjectileData[lVar1].bsound=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.bsound);
Gv_SetVarX(lVar2, ProjectileData[lVar1].bsound);
return;
case PROJ_RANGE:
if (iSet)
{
g_tile[lVar1].proj.range=lValue;
ProjectileData[lVar1].range=lValue;
return;
}
Gv_SetVarX(lVar2, g_tile[lVar1].proj.range);
Gv_SetVarX(lVar2, ProjectileData[lVar1].range);
return;
default:

View file

@ -1018,7 +1018,7 @@ void Gv_ResetSystemDefaults(void)
g_iActorVarID=Gv_GetVarIndex("actorvar");
for (i=MAXTILES-1; i>=0; i--)
Bmemcpy(&g_tile[i].proj, &g_tile[i].defproj, sizeof(projectile_t));
Bmemcpy(&ProjectileData[i], &g_tile[i].defproj, sizeof(projectile_t));
//AddLog("EOF:ResetWeaponDefaults");
}

View file

@ -56,6 +56,7 @@ G_EXTERN int32_t myconnectindex, numplayers;
G_EXTERN const char *s_buildRev;
G_EXTERN DukeStatus_t sbar;
G_EXTERN actor_t actor[MAXSPRITES];
// g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game
G_EXTERN tiledata_t g_tile[MAXTILES];
G_EXTERN animwalltype animwall[MAXANIMWALLS];
G_EXTERN char *ScriptQuotes[MAXQUOTES],*ScriptQuoteRedefinitions[MAXQUOTES];
@ -136,6 +137,7 @@ G_EXTERN playerdata_t g_player[MAXPLAYERS];
G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
G_EXTERN input_t inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
#pragma pack(pop)
G_EXTERN projectile_t ProjectileData[MAXTILES];
G_EXTERN projectile_t SpriteProjectile[MAXSPRITES];
G_EXTERN sound_t g_sounds[MAXSOUNDS];
G_EXTERN uint32_t everyothertime;

View file

@ -155,9 +155,9 @@ static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang,
Bmemcpy(&destvect, dv, sizeof(vec3_t));
srcvect.x = sv->x + (sintable[(348+ang+512)&2047]/g_tile[atwith].proj.offset);
srcvect.y = sv->y + (sintable[(ang+348)&2047]/g_tile[atwith].proj.offset);
srcvect.z = sv->z + 1024+(g_tile[atwith].proj.toffset<<8);
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);
n = ((FindDistance2D(srcvect.x-destvect.x,srcvect.y-destvect.y))>>8)+1;
@ -169,7 +169,7 @@ static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang,
srcvect.y += destvect.y>>2;
srcvect.z += (destvect.z>>2);
for (i=g_tile[atwith].proj.tnum; i>0; i--)
for (i=ProjectileData[atwith].tnum; i>0; i--)
{
srcvect.x += destvect.x;
srcvect.y += destvect.y;
@ -180,8 +180,8 @@ static void A_HitscanProjTrail(const vec3_t *sv, const vec3_t *dv, int32_t ang,
getzsofslope(sect,srcvect.x,srcvect.y,&n,&j);
if (srcvect.z > j || srcvect.z < n)
break;
j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,g_tile[atwith].proj.trail,-32,
g_tile[atwith].proj.txrepeat,g_tile[atwith].proj.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, STAT_ACTOR);
}
}
@ -216,7 +216,7 @@ static int32_t A_FindTargetSprite(spritetype *s,int32_t aang,int32_t atwith)
if (g_player[s->yvel].ps->auto_aim == 2)
{
if (A_CheckSpriteTileFlags(atwith,SPRITE_PROJECTILE) && (g_tile[atwith].proj.workslike & PROJECTILE_RPG))
if (A_CheckSpriteTileFlags(atwith,SPRITE_PROJECTILE) && (ProjectileData[atwith].workslike & PROJECTILE_RPG))
return -1;
else switch (DYNAMICTILEMAP(atwith))
{
@ -448,32 +448,32 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
/* Custom projectiles */
#ifdef POLYMER
if (g_tile[atwith].proj.flashcolor)
if (ProjectileData[atwith].flashcolor)
{
int32_t x = ((sintable[(s->ang+512)&2047])>>7), y = ((sintable[(s->ang)&2047])>>7);
s-> x += x;
s-> y += y;
G_AddGameLight(0, i, PHEIGHT, 8192, g_tile[atwith].proj.flashcolor,PR_LIGHT_PRIO_MAX_GAME);
G_AddGameLight(0, i, PHEIGHT, 8192, ProjectileData[atwith].flashcolor,PR_LIGHT_PRIO_MAX_GAME);
actor[i].lightcount = 2;
s-> x -= x;
s-> y -= y;
}
#endif // POLYMER
if (g_tile[atwith].proj.offset == 0) g_tile[atwith].proj.offset = 1;
if (ProjectileData[atwith].offset == 0) ProjectileData[atwith].offset = 1;
if (g_tile[atwith].proj.workslike & PROJECTILE_BLOOD || g_tile[atwith].proj.workslike & PROJECTILE_KNEE)
if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD || ProjectileData[atwith].workslike & PROJECTILE_KNEE)
{
if (g_tile[atwith].proj.workslike & PROJECTILE_BLOOD)
if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD)
{
sa += 64 - (krand()&127);
if (p < 0) sa += 1024;
zvel = 1024-(krand()&2047);
}
if (g_tile[atwith].proj.workslike & PROJECTILE_KNEE)
if (ProjectileData[atwith].workslike & PROJECTILE_KNEE)
{
if (p >= 0)
{
@ -481,7 +481,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
srcvect.z += (6<<8);
sa += 15;
}
else if (!(g_tile[atwith].proj.workslike & PROJECTILE_NOAIM))
else if (!(ProjectileData[atwith].workslike & PROJECTILE_NOAIM))
{
j = g_player[A_FindPlayer(s,&x)].ps->i;
zvel = ((sprite[j].z-srcvect.z)<<8) / (x+1);
@ -495,21 +495,21 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
sintable[sa&2047],zvel<<6,
&hit,CLIPMASK1);
if (g_tile[atwith].proj.workslike & PROJECTILE_BLOOD)
if (ProjectileData[atwith].workslike & PROJECTILE_BLOOD)
{
if (g_tile[atwith].proj.range == 0)
g_tile[atwith].proj.range = 1024;
if (ProjectileData[atwith].range == 0)
ProjectileData[atwith].range = 1024;
if (FindDistance2D(srcvect.x-hit.pos.x,srcvect.y-hit.pos.y) < g_tile[atwith].proj.range)
if (FindDistance2D(srcvect.x-hit.pos.x,srcvect.y-hit.pos.y) < ProjectileData[atwith].range)
if (FindDistance2D(wall[hit.wall].x-wall[wall[hit.wall].point2].x,wall[hit.wall].y-wall[wall[hit.wall].point2].y) >
(mulscale(g_tile[atwith].proj.xrepeat+8,tilesizx[g_tile[atwith].proj.decal],3)))
(mulscale(ProjectileData[atwith].xrepeat+8,tilesizx[ProjectileData[atwith].decal],3)))
if (hit.wall >= 0 && wall[hit.wall].overpicnum != BIGFORCE)
if ((wall[hit.wall].nextsector >= 0 && hit.sect >= 0 &&
sector[wall[hit.wall].nextsector].lotag == 0 &&
sector[hit.sect].lotag == 0 &&
sector[wall[hit.wall].nextsector].lotag == 0 &&
(sector[hit.sect].floorz-sector[wall[hit.wall].nextsector].floorz) >
(mulscale(g_tile[atwith].proj.yrepeat,tilesizy[g_tile[atwith].proj.decal],3)<<8)) ||
(mulscale(ProjectileData[atwith].yrepeat,tilesizy[ProjectileData[atwith].decal],3)<<8)) ||
(wall[hit.wall].nextsector == -1 && sector[hit.sect].lotag == 0))
if ((wall[hit.wall].cstat&16) == 0)
{
@ -530,9 +530,9 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
if (wall[hit.wall].hitag == 0)
{
if (g_tile[atwith].proj.decal >= 0)
if (ProjectileData[atwith].decal >= 0)
{
k = A_Spawn(i,g_tile[atwith].proj.decal);
k = A_Spawn(i,ProjectileData[atwith].decal);
if (!A_CheckSpriteFlags(k , SPRITE_DECAL))
actor[k].flags |= SPRITE_DECAL;
@ -546,18 +546,18 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
sprite[k].y = hit.pos.y;
sprite[k].z = hit.pos.z;
*/
if (g_tile[atwith].proj.workslike & PROJECTILE_RANDDECALSIZE)
if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE)
{
int32_t wh = (krand()&g_tile[atwith].proj.xrepeat);
if (wh < g_tile[atwith].proj.yrepeat)
wh = g_tile[atwith].proj.yrepeat;
int32_t wh = (krand()&ProjectileData[atwith].xrepeat);
if (wh < ProjectileData[atwith].yrepeat)
wh = ProjectileData[atwith].yrepeat;
sprite[k].xrepeat = wh;
sprite[k].yrepeat = wh;
}
else
{
sprite[k].xrepeat = g_tile[atwith].proj.xrepeat;
sprite[k].yrepeat = g_tile[atwith].proj.yrepeat;
sprite[k].xrepeat = ProjectileData[atwith].xrepeat;
sprite[k].yrepeat = ProjectileData[atwith].yrepeat;
}
sprite[k].z += sprite[k].yrepeat<<8;
// sprite[k].cstat = 16+(krand()&12);
@ -592,29 +592,29 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
if (hit.sect < 0) return -1;
if ((g_tile[atwith].proj.range == 0) && (g_tile[atwith].proj.workslike & PROJECTILE_KNEE))
g_tile[atwith].proj.range = 1024;
if ((ProjectileData[atwith].range == 0) && (ProjectileData[atwith].workslike & PROJECTILE_KNEE))
ProjectileData[atwith].range = 1024;
if ((g_tile[atwith].proj.range > 0) && ((klabs(srcvect.x-hit.pos.x)+klabs(srcvect.y-hit.pos.y)) > g_tile[atwith].proj.range))
if ((ProjectileData[atwith].range > 0) && ((klabs(srcvect.x-hit.pos.x)+klabs(srcvect.y-hit.pos.y)) > ProjectileData[atwith].range))
return -1;
else
{
if (hit.wall >= 0 || hit.sprite >= 0)
{
j = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,atwith,-15,0,0,sa,32,0,i,4);
SpriteProjectile[j].workslike = g_tile[sprite[j].picnum].proj.workslike;
sprite[j].extra = g_tile[atwith].proj.extra;
if (g_tile[atwith].proj.extra_rand > 0)
sprite[j].extra += (krand()&g_tile[atwith].proj.extra_rand);
SpriteProjectile[j].workslike = ProjectileData[sprite[j].picnum].workslike;
sprite[j].extra = ProjectileData[atwith].extra;
if (ProjectileData[atwith].extra_rand > 0)
sprite[j].extra += (krand()&ProjectileData[atwith].extra_rand);
if (p >= 0)
{
if (g_tile[atwith].proj.spawns >= 0)
if (ProjectileData[atwith].spawns >= 0)
{
k = A_Spawn(j,g_tile[atwith].proj.spawns);
k = A_Spawn(j,ProjectileData[atwith].spawns);
sprite[k].z -= (8<<8);
A_SetHitData(k, &hit);
}
if (g_tile[atwith].proj.sound >= 0) A_PlaySound(g_tile[atwith].proj.sound,j);
if (ProjectileData[atwith].sound >= 0) A_PlaySound(ProjectileData[atwith].sound,j);
}
if (p >= 0 && ps->inv_amount[GET_STEROIDS] > 0 && ps->inv_amount[GET_STEROIDS] < 400)
@ -655,9 +655,9 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
return -1;
}
if (g_tile[atwith].proj.workslike & PROJECTILE_HITSCAN)
if (ProjectileData[atwith].workslike & PROJECTILE_HITSCAN)
{
if (s->extra >= 0) s->shade = g_tile[atwith].proj.shade;
if (s->extra >= 0) s->shade = ProjectileData[atwith].shade;
if (p >= 0)
{
@ -675,7 +675,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
angRange=Gv_GetVar(g_iAngRangeVarID,i,p);
zRange=Gv_GetVar(g_iZRangeVarID,i,p);
if (g_tile[atwith].proj.workslike & PROJECTILE_ACCURATE_AUTOAIM)
if (ProjectileData[atwith].workslike & PROJECTILE_ACCURATE_AUTOAIM)
{
if (!ps->auto_aim)
{
@ -693,7 +693,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
if (j == -1)
{
zvel = (100-ps->horiz-ps->horizoff)<<5;
if (!(g_tile[atwith].proj.workslike & PROJECTILE_ACCURATE))
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{
sa += (angRange/2)-(krand()&(angRange-1));
zvel += (zRange/2)-(krand()&(zRange-1));
@ -707,7 +707,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
// no target
zvel = (100-ps->horiz-ps->horizoff)<<5;
}
if (!(g_tile[atwith].proj.workslike & PROJECTILE_ACCURATE))
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{
sa += (angRange/2)-(krand()&(angRange-1));
zvel += (zRange/2)-(krand()&(zRange-1));
@ -725,7 +725,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
zvel = ((g_player[j].ps->pos.z-srcvect.z) <<8) / hit.pos.x;
if (s->picnum != BOSS1)
{
if (!(g_tile[atwith].proj.workslike & PROJECTILE_ACCURATE))
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{
zvel += 128-(krand()&255);
sa += 32-(krand()&63);
@ -735,7 +735,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
{
sa = getangle(g_player[j].ps->pos.x-srcvect.x,g_player[j].ps->pos.y-srcvect.y);
if (!(g_tile[atwith].proj.workslike & PROJECTILE_ACCURATE))
if (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE))
{
zvel += 128-(krand()&255);
sa += 64-(krand()&127);
@ -743,7 +743,7 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
}
}
if (g_tile[atwith].proj.cstat >= 0) s->cstat &= ~g_tile[atwith].proj.cstat;
if (ProjectileData[atwith].cstat >= 0) s->cstat &= ~ProjectileData[atwith].cstat;
else s->cstat &= ~257;
if (actor[i].shootzvel) zvel = actor[i].shootzvel;
@ -753,19 +753,19 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
zvel<<6,&hit,CLIPMASK1);
if (g_tile[atwith].proj.cstat >= 0) s->cstat |= g_tile[atwith].proj.cstat;
if (ProjectileData[atwith].cstat >= 0) s->cstat |= ProjectileData[atwith].cstat;
else s->cstat |= 257;
if (hit.sect < 0) return -1;
if ((g_tile[atwith].proj.range > 0) &&
((klabs(srcvect.x-hit.pos.x)+klabs(srcvect.y-hit.pos.y)) > g_tile[atwith].proj.range))
if ((ProjectileData[atwith].range > 0) &&
((klabs(srcvect.x-hit.pos.x)+klabs(srcvect.y-hit.pos.y)) > ProjectileData[atwith].range))
return -1;
if (g_tile[atwith].proj.trail >= 0)
if (ProjectileData[atwith].trail >= 0)
A_HitscanProjTrail(&srcvect,&hit.pos,sa,atwith);
if (g_tile[atwith].proj.workslike & PROJECTILE_WATERBUBBLES)
if (ProjectileData[atwith].workslike & PROJECTILE_WATERBUBBLES)
{
if ((krand()&15) == 0 && sector[hit.sect].lotag == ST_2_UNDERWATER)
A_DoWaterTracers(hit.pos.x,hit.pos.y,hit.pos.z,srcvect.x,srcvect.y,srcvect.z,8-(ud.multimode>>1));
@ -774,9 +774,9 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
if (p >= 0)
{
k = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,SHOTSPARK1,-15,10,10,sa,0,0,i,4);
sprite[k].extra = g_tile[atwith].proj.extra;
if (g_tile[atwith].proj.extra_rand > 0)
sprite[k].extra += (krand()%g_tile[atwith].proj.extra_rand);
sprite[k].extra = ProjectileData[atwith].extra;
if (ProjectileData[atwith].extra_rand > 0)
sprite[k].extra += (krand()%ProjectileData[atwith].extra_rand);
sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1
A_SetHitData(k, &hit);
@ -793,11 +793,11 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
else
Sect_DamageCeiling(hit.sect);
}
if (g_tile[atwith].proj.spawns >= 0)
if (ProjectileData[atwith].spawns >= 0)
{
int32_t wh=A_Spawn(k,g_tile[atwith].proj.spawns);
if (g_tile[atwith].proj.sxrepeat > 4) sprite[wh].xrepeat=g_tile[atwith].proj.sxrepeat;
if (g_tile[atwith].proj.syrepeat > 4) sprite[wh].yrepeat=g_tile[atwith].proj.syrepeat;
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
A_SetHitData(wh, &hit);
}
}
@ -818,11 +818,11 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
}
else
{
if (g_tile[atwith].proj.spawns >= 0)
if (ProjectileData[atwith].spawns >= 0)
{
int32_t wh=A_Spawn(k,g_tile[atwith].proj.spawns);
if (g_tile[atwith].proj.sxrepeat > 4) sprite[wh].xrepeat=g_tile[atwith].proj.sxrepeat;
if (g_tile[atwith].proj.syrepeat > 4) sprite[wh].yrepeat=g_tile[atwith].proj.syrepeat;
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
A_SetHitData(wh, &hit);
}
}
@ -834,11 +834,11 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
}
else if (hit.wall >= 0)
{
if (g_tile[atwith].proj.spawns >= 0)
if (ProjectileData[atwith].spawns >= 0)
{
int32_t wh=A_Spawn(k,g_tile[atwith].proj.spawns);
if (g_tile[atwith].proj.sxrepeat > 4) sprite[wh].xrepeat=g_tile[atwith].proj.sxrepeat;
if (g_tile[atwith].proj.syrepeat > 4) sprite[wh].yrepeat=g_tile[atwith].proj.syrepeat;
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
A_SetHitData(wh, &hit);
}
if (CheckDoorTile(wall[hit.wall].picnum) == 1)
@ -872,14 +872,14 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
l = headspritestat[STAT_MISC];
while (l >= 0)
{
if (sprite[l].picnum == g_tile[atwith].proj.decal)
if (sprite[l].picnum == ProjectileData[atwith].decal)
if (dist(&sprite[l],&sprite[k]) < (12+(krand()&7)))
goto DOSKIPBULLETHOLE;
l = nextspritestat[l];
}
if (g_tile[atwith].proj.decal >= 0)
if (ProjectileData[atwith].decal >= 0)
{
l = A_Spawn(k,g_tile[atwith].proj.decal);
l = A_Spawn(k,ProjectileData[atwith].decal);
if (!A_CheckSpriteFlags(l , SPRITE_DECAL))
actor[l].flags |= SPRITE_DECAL;
@ -887,18 +887,18 @@ int32_t A_Shoot(int32_t i, int32_t atwith)
sprite[l].xvel = -1;
sprite[l].ang = getangle(wall[hit.wall].x-wall[wall[hit.wall].point2].x,
wall[hit.wall].y-wall[wall[hit.wall].point2].y)+512;
if (g_tile[atwith].proj.workslike & PROJECTILE_RANDDECALSIZE)
if (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE)
{
int32_t wh = (krand()&g_tile[atwith].proj.xrepeat);
if (wh < g_tile[atwith].proj.yrepeat)
wh = g_tile[atwith].proj.yrepeat;
int32_t wh = (krand()&ProjectileData[atwith].xrepeat);
if (wh < ProjectileData[atwith].yrepeat)
wh = ProjectileData[atwith].yrepeat;
sprite[l].xrepeat = wh;
sprite[l].yrepeat = wh;
}
else
{
sprite[l].xrepeat = g_tile[atwith].proj.xrepeat;
sprite[l].yrepeat = g_tile[atwith].proj.yrepeat;
sprite[l].xrepeat = ProjectileData[atwith].xrepeat;
sprite[l].yrepeat = ProjectileData[atwith].yrepeat;
}
sprite[l].cstat = 16+(krand()&12);
sprite[l].x -= mulscale13(1,sintable[(sprite[l].ang+2560)&2047]);
@ -922,9 +922,9 @@ DOSKIPBULLETHOLE:
else
{
k = A_InsertSprite(hit.sect,hit.pos.x,hit.pos.y,hit.pos.z,SHOTSPARK1,-15,24,24,sa,0,0,i,4);
sprite[k].extra = g_tile[atwith].proj.extra;
if (g_tile[atwith].proj.extra_rand > 0)
sprite[k].extra += (krand()%g_tile[atwith].proj.extra_rand);
sprite[k].extra = ProjectileData[atwith].extra;
if (ProjectileData[atwith].extra_rand > 0)
sprite[k].extra += (krand()%ProjectileData[atwith].extra_rand);
sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1
A_SetHitData(k, &hit);
@ -933,11 +933,11 @@ DOSKIPBULLETHOLE:
A_DamageObject(hit.sprite,k);
if (sprite[hit.sprite].picnum != APLAYER)
{
if (g_tile[atwith].proj.spawns >= 0)
if (ProjectileData[atwith].spawns >= 0)
{
int32_t wh=A_Spawn(k,g_tile[atwith].proj.spawns);
if (g_tile[atwith].proj.sxrepeat > 4) sprite[wh].xrepeat=g_tile[atwith].proj.sxrepeat;
if (g_tile[atwith].proj.syrepeat > 4) sprite[wh].yrepeat=g_tile[atwith].proj.syrepeat;
int32_t wh=A_Spawn(k,ProjectileData[atwith].spawns);
if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat;
if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat;
A_SetHitData(wh, &hit);
}
}
@ -947,21 +947,21 @@ DOSKIPBULLETHOLE:
A_DamageWall(k,hit.wall,&hit.pos,atwith);
}
if ((krand()&255) < 4 && g_tile[atwith].proj.isound >= 0)
S_PlaySound3D(g_tile[atwith].proj.isound,k,&hit.pos);
if ((krand()&255) < 4 && ProjectileData[atwith].isound >= 0)
S_PlaySound3D(ProjectileData[atwith].isound,k,&hit.pos);
return -1;
}
if (g_tile[atwith].proj.workslike & PROJECTILE_RPG)
if (ProjectileData[atwith].workslike & PROJECTILE_RPG)
{
/* if(tile[atwith].proj.workslike & PROJECTILE_FREEZEBLAST)
sz += (3<<8);*/
if (s->extra >= 0) s->shade = g_tile[atwith].proj.shade;
if (s->extra >= 0) s->shade = ProjectileData[atwith].shade;
vel = g_tile[atwith].proj.vel;
vel = ProjectileData[atwith].vel;
j = -1;
@ -970,15 +970,15 @@ DOSKIPBULLETHOLE:
j = GetAutoAimAngle(i, p, atwith, 8<<8, 0+2, &srcvect, vel, &zvel, &sa);
if (j < 0)
zvel = (100-ps->horiz-ps->horizoff)*(g_tile[atwith].proj.vel/8);
zvel = (100-ps->horiz-ps->horizoff)*(ProjectileData[atwith].vel/8);
// zvel = (100-ps->horiz-ps->horizoff)*81;
if (g_tile[atwith].proj.sound >= 0)
A_PlaySound(g_tile[atwith].proj.sound,i);
if (ProjectileData[atwith].sound >= 0)
A_PlaySound(ProjectileData[atwith].sound,i);
}
else
{
if (!(g_tile[atwith].proj.workslike & PROJECTILE_NOAIM))
if (!(ProjectileData[atwith].workslike & PROJECTILE_NOAIM))
{
j = A_FindPlayer(s,&x);
sa = getangle(g_player[j].ps->opos.x-srcvect.x,g_player[j].ps->opos.y-srcvect.y);
@ -1007,21 +1007,21 @@ DOSKIPBULLETHOLE:
sz-(1<<8),atwith,0,14,14,sa,vel,zvel,i,4);*/
if (actor[i].shootzvel) zvel = actor[i].shootzvel;
j = A_InsertSprite(sect,
srcvect.x+(sintable[(348+sa+512)&2047]/g_tile[atwith].proj.offset),
srcvect.y+(sintable[(sa+348)&2047]/g_tile[atwith].proj.offset),
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=g_tile[atwith].proj.xrepeat;
sprite[j].yrepeat=g_tile[atwith].proj.yrepeat;
sprite[j].xrepeat=ProjectileData[atwith].xrepeat;
sprite[j].yrepeat=ProjectileData[atwith].yrepeat;
if (g_tile[atwith].proj.extra_rand > 0)
sprite[j].extra += (krand()&g_tile[atwith].proj.extra_rand);
if (!(g_tile[atwith].proj.workslike & PROJECTILE_BOUNCESOFFWALLS))
if (ProjectileData[atwith].extra_rand > 0)
sprite[j].extra += (krand()&ProjectileData[atwith].extra_rand);
if (!(ProjectileData[atwith].workslike & PROJECTILE_BOUNCESOFFWALLS))
sprite[j].yvel = l;
else
{
if (g_tile[atwith].proj.bounces >= 1) sprite[j].yvel = g_tile[atwith].proj.bounces;
if (ProjectileData[atwith].bounces >= 1) sprite[j].yvel = ProjectileData[atwith].bounces;
else sprite[j].yvel = g_numFreezeBounces;
// sprite[j].xrepeat >>= 1;
// sprite[j].yrepeat >>= 1;
@ -1038,12 +1038,12 @@ DOSKIPBULLETHOLE:
}
}
*/
if (g_tile[atwith].proj.cstat >= 0) sprite[j].cstat = g_tile[atwith].proj.cstat;
if (ProjectileData[atwith].cstat >= 0) sprite[j].cstat = ProjectileData[atwith].cstat;
else sprite[j].cstat = 128;
if (g_tile[atwith].proj.clipdist != 255) sprite[j].clipdist = g_tile[atwith].proj.clipdist;
if (ProjectileData[atwith].clipdist != 255) sprite[j].clipdist = ProjectileData[atwith].clipdist;
else sprite[j].clipdist = 40;
Bmemcpy(&SpriteProjectile[j], &g_tile[sprite[j].picnum].proj, sizeof(g_tile[sprite[j].picnum].proj));
Bmemcpy(&SpriteProjectile[j], &ProjectileData[sprite[j].picnum], sizeof(ProjectileData[sprite[j].picnum]));
// sa = s->ang+32-(krand()&63);
// zvel = oldzvel+512-(krand()&1023);

View file

@ -967,6 +967,7 @@ static const dataspec_t svgm_secwsp[] =
{ DS_NOCHK, &g_mirrorSector[0], sizeof(g_mirrorSector[0]), sizeof(g_mirrorSector)/sizeof(g_mirrorSector[0]) },
// projectiles
{ 0, &SpriteProjectile[0], sizeof(projectile_t), MAXSPRITES },
{ 0, &ProjectileData[0], sizeof(projectile_t), MAXTILES },
{ 0, &everyothertime, sizeof(everyothertime), 1 },
{ DS_END, 0, 0, 0 }
};
@ -979,7 +980,7 @@ static const dataspec_t svgm_script[] =
{ DS_DYNAMIC|DS_CNT(savegame_bitptrsize)|DS_NOCHK, &bitptr, sizeof(bitptr[0]), (intptr_t)&savegame_bitptrsize },
{ DS_SAVEFN|DS_NOCHK, (void *)&sv_prescriptsave_once, 0, 1 },
{ 0, &g_tile[0], sizeof(tiledata_t), MAXTILES },
{ DS_NOCHK, &g_tile[0], sizeof(tiledata_t), MAXTILES },
{ DS_LOADFN|DS_NOCHK, (void *)&sv_prescriptload_once, 0, 1 },
{ DS_DYNAMIC|DS_CNT(g_scriptSize)|DS_NOCHK, &script, sizeof(script[0]), (intptr_t)&g_scriptSize },
// { DS_NOCHK, &apScriptGameEvent[0], sizeof(apScriptGameEvent[0]), MAXGAMEEVENTS },