Retire the actorscrptr[], actorLoadEventScrptr[], SpriteFlags[], ActorType[], SpriteCacheList[], ProjectileData[] and DefaultProjectile[] arrays in favor of a tile_t structure exposed as g_tile[]. This consolidates most of the MAXTILES sized arrays on the game side into one place.

git-svn-id: https://svn.eduke32.com/eduke32@3102 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-10-30 15:54:35 +00:00
parent f18ef269ed
commit 88c95a18f7
19 changed files with 375 additions and 306 deletions

View file

@ -341,7 +341,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
clipdist = 1024; clipdist = 1024;
else if (spr->picnum == LIZMAN) else if (spr->picnum == LIZMAN)
clipdist = 292; clipdist = 292;
else if (ActorType[spr->picnum]&3) else if (A_CheckSpriteTileFlags(spr->picnum, SPRITE_BADGUY))
clipdist = spr->clipdist<<2; clipdist = spr->clipdist<<2;
else else
clipdist = 192; clipdist = 192;
@ -664,7 +664,8 @@ void Sect_ClearInterpolation(int32_t sectnum)
static int32_t move_fixed_sprite(int32_t j, int32_t pivotspr, int32_t daang) static int32_t move_fixed_sprite(int32_t j, int32_t pivotspr, int32_t daang)
{ {
if ((FIXSPR_STATNUMP(sprite[j].statnum) || if ((FIXSPR_STATNUMP(sprite[j].statnum) ||
((sprite[j].statnum==STAT_ACTOR || sprite[j].statnum==STAT_ZOMBIEACTOR) && (ActorType[sprite[j].picnum]&4))) ((sprite[j].statnum==STAT_ACTOR || sprite[j].statnum==STAT_ZOMBIEACTOR) &&
A_CheckSpriteTileFlags(sprite[j].picnum, SPRITE_BADGUY)))
&& actor[j].t_data[7]==(0x18190000|pivotspr)) && actor[j].t_data[7]==(0x18190000|pivotspr))
{ {
rotatepoint(0,0, actor[j].t_data[8],actor[j].t_data[9], daang&2047, &sprite[j].x,&sprite[j].y); rotatepoint(0,0, actor[j].t_data[8],actor[j].t_data[9], daang&2047, &sprite[j].x,&sprite[j].y);
@ -1123,7 +1124,7 @@ ACTOR_STATIC void G_MovePlayers(void)
otherx = 0; otherx = 0;
} }
if (actorscrptr[sprite[i].picnum]) if (g_tile[sprite[i].picnum].execPtr)
A_Execute(i,s->yvel,otherx); A_Execute(i,s->yvel,otherx);
if (g_netServer || ud.multimode > 1) if (g_netServer || ud.multimode > 1)
@ -2410,7 +2411,7 @@ CLEAR_THE_BOLT:
case STEAM__STATIC: case STEAM__STATIC:
case CEILINGSTEAM__STATIC: case CEILINGSTEAM__STATIC:
case WATERBUBBLEMAKER__STATIC: case WATERBUBBLEMAKER__STATIC:
if (!actorscrptr[sprite[i].picnum]) if (!g_tile[sprite[i].picnum].execPtr)
goto BOLT; goto BOLT;
{ {
int32_t p = A_FindPlayer(s, &x); int32_t p = A_FindPlayer(s, &x);
@ -2796,7 +2797,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
if (proj->workslike & PROJECTILE_HITSCAN) if (proj->workslike & PROJECTILE_HITSCAN)
{ {
if (!actorscrptr[sprite[i].picnum]) if (!g_tile[sprite[i].picnum].execPtr)
goto BOLT; goto BOLT;
{ {
int32_t p = A_FindPlayer(s,&x); int32_t p = A_FindPlayer(s,&x);
@ -3116,7 +3117,7 @@ COOLEXPLOSION:
goto BOLT; goto BOLT;
case SHOTSPARK1__STATIC: case SHOTSPARK1__STATIC:
if (!actorscrptr[sprite[i].picnum]) if (!g_tile[sprite[i].picnum].execPtr)
goto BOLT; goto BOLT;
{ {
int32_t p = A_FindPlayer(s,&x); int32_t p = A_FindPlayer(s,&x);
@ -4868,7 +4869,7 @@ DETONATEB:
} }
} }
if (!actorscrptr[sprite[i].picnum]) if (!g_tile[sprite[i].picnum].execPtr)
goto BOLT; goto BOLT;
{ {
int32_t p = A_FindPlayer(s,&x); int32_t p = A_FindPlayer(s,&x);
@ -5309,7 +5310,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
case TRANSPORTERSTAR__STATIC: case TRANSPORTERSTAR__STATIC:
case TRANSPORTERBEAM__STATIC: case TRANSPORTERBEAM__STATIC:
{ {
if (!actorscrptr[sprite[i].picnum]) if (!g_tile[sprite[i].picnum].execPtr)
goto BOLT; goto BOLT;
{ {
int32_t p = A_FindPlayer(s,&x); int32_t p = A_FindPlayer(s,&x);
@ -8182,7 +8183,6 @@ int32_t A_CheckEnemyTile(int32_t pn)
//this case can't be handled by the dynamictostatic system because it adds //this case can't be handled by the dynamictostatic system because it adds
//stuff to the value from names.h so handling separately //stuff to the value from names.h so handling separately
if (A_CheckSpriteTileFlags(pn, SPRITE_BADGUY) || if (A_CheckSpriteTileFlags(pn, SPRITE_BADGUY) ||
(ActorType[pn]&3) ||
(pn >= GREENSLIME && pn <= GREENSLIME+7)) (pn >= GREENSLIME && pn <= GREENSLIME+7))
return 1; return 1;

View file

@ -165,6 +165,20 @@ typedef struct {
int16_t actorstayput, dispicnum, shootzvel, cgg; // 8b int16_t actorstayput, dispicnum, shootzvel, cgg; // 8b
} netactor_t; } netactor_t;
typedef struct {
intptr_t *execPtr; // pointer to CON script for this tile, formerly actorscrptr
intptr_t *loadPtr; // pointer to load time CON script, formerly actorLoadEventScrPtr or something
uint32_t flags; // formerly SpriteFlags, ActorType
int16_t cacherange[2]; // formerly SpriteCache
// todo: make these pointers and allocate at runtime
projectile_t proj;
projectile_t defproj;
} tiledata_t;
#pragma pack(pop) #pragma pack(pop)
enum sflags_t { enum sflags_t {
@ -183,6 +197,8 @@ enum sflags_t {
SPRITE_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked SPRITE_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked
SPRITE_SMOOTHMOVE = 0x00002000, SPRITE_SMOOTHMOVE = 0x00002000,
SPRITE_NOTELEPORT = 0x00004000, SPRITE_NOTELEPORT = 0x00004000,
SPRITE_BADGUYSTAYPUT = 0x00008000,
SPRITE_CACHE = 0x00010000,
}; };
// custom projectiles // custom projectiles
@ -210,19 +226,13 @@ enum pflags_t {
PROJECTILE_ACCURATE = 0x00100000, PROJECTILE_ACCURATE = 0x00100000,
}; };
extern tiledata_t g_tile[MAXTILES];
extern actor_t actor[MAXSPRITES]; extern actor_t actor[MAXSPRITES];
extern char ActorType[MAXTILES];
extern int16_t SpriteCacheList[MAXTILES][3];
extern int32_t SpriteFlags[MAXTILES];
extern int32_t block_deletesprite; extern int32_t block_deletesprite;
extern int32_t g_noEnemies; extern int32_t g_noEnemies;
extern int32_t otherp; extern int32_t otherp;
extern int32_t ticrandomseed; extern int32_t ticrandomseed;
extern intptr_t *actorLoadEventScrptr[MAXTILES];
extern intptr_t *actorscrptr[MAXTILES];
extern intptr_t *g_parsingActorPtr; extern intptr_t *g_parsingActorPtr;
extern projectile_t DefaultProjectileData[MAXTILES];
extern projectile_t ProjectileData[MAXTILES];
extern projectile_t SpriteProjectile[MAXSPRITES]; extern projectile_t SpriteProjectile[MAXSPRITES];

View file

@ -3978,16 +3978,16 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
// sprpos[i].ang = sprpos[i].oldang = sprite[i].ang; // sprpos[i].ang = sprpos[i].oldang = sprite[i].ang;
if (actorscrptr[s_pn]) if (g_tile[s_pn].execPtr)
{ {
s->extra = *actorscrptr[s_pn]; s->extra = *g_tile[s_pn].execPtr;
T5 = *(actorscrptr[s_pn]+1); T5 = *(g_tile[s_pn].execPtr+1);
T2 = *(actorscrptr[s_pn]+2); T2 = *(g_tile[s_pn].execPtr+2);
#ifdef LUNATIC #ifdef LUNATIC
set_action_members(i); set_action_members(i);
set_move_members(i); set_move_members(i);
#endif #endif
s->hitag = *(actorscrptr[s_pn]+3); s->hitag = *(g_tile[s_pn].execPtr+3);
} }
if (show2dsector[SECT>>3]&(1<<(SECT&7))) show2dsprite[i>>3] |= (1<<(i&7)); if (show2dsector[SECT>>3]&(1<<(SECT&7))) show2dsprite[i>>3] |= (1<<(i&7));
@ -4107,17 +4107,17 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (CS&1) CS |= 256; if (CS&1) CS |= 256;
if (actorscrptr[s]) if (g_tile[s].execPtr)
{ {
SH = *(actorscrptr[s]); SH = *(g_tile[s].execPtr);
T5 = *(actorscrptr[s]+1); T5 = *(g_tile[s].execPtr+1);
T2 = *(actorscrptr[s]+2); T2 = *(g_tile[s].execPtr+2);
#ifdef LUNATIC #ifdef LUNATIC
set_action_members(i); set_action_members(i);
set_move_members(i); set_move_members(i);
#endif #endif
if (*(actorscrptr[s]+3) && SHT == 0) if (*(g_tile[s].execPtr+3) && SHT == 0)
SHT = *(actorscrptr[s]+3); SHT = *(g_tile[s].execPtr+3);
} }
else T2 = T5 = 0; else T2 = T5 = 0;
} }
@ -4162,7 +4162,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
else switch (DYNAMICTILEMAP(sp->picnum)) else switch (DYNAMICTILEMAP(sp->picnum))
{ {
default: default:
if (actorscrptr[sp->picnum]) if (g_tile[sp->picnum].execPtr)
{ {
if (j == -1 && sp->lotag > ud.player_skill) if (j == -1 && sp->lotag > ud.player_skill)
{ {
@ -4175,7 +4175,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (sp->xrepeat == 0 || sp->yrepeat == 0) if (sp->xrepeat == 0 || sp->yrepeat == 0)
sp->xrepeat = sp->yrepeat = 1; sp->xrepeat = sp->yrepeat = 1;
if (ActorType[sp->picnum] & 3) if (A_CheckSpriteTileFlags(sp->picnum, SPRITE_BADGUY))
{ {
if (ud.monsters_off == 1) if (ud.monsters_off == 1)
{ {
@ -4186,7 +4186,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
A_Fall(i); A_Fall(i);
if (ActorType[sp->picnum] & 2) if (A_CheckSpriteTileFlags(sp->picnum, SPRITE_BADGUYSTAYPUT))
actor[i].actorstayput = sp->sectnum; actor[i].actorstayput = sp->sectnum;
g_player[myconnectindex].ps->max_actors_killed++; g_player[myconnectindex].ps->max_actors_killed++;
@ -5044,8 +5044,27 @@ int32_t A_Spawn(int32_t j, int32_t pn)
break; break;
} }
} }
else
{
switch (DYNAMICTILEMAP(sp->picnum))
{
case LIZTROOPONTOILET__STATIC:
case LIZTROOPSHOOT__STATIC:
case LIZTROOPJETPACK__STATIC:
case LIZTROOPDUCKING__STATIC:
case LIZTROOPRUNNING__STATIC:
case LIZTROOPSTAYPUT__STATIC:
case LIZTROOPJUSTSIT__STATIC:
case LIZTROOP__STATIC:
if (g_scriptVersion == 13)
default:
sp->extra <<= 1;
break;
}
}
if (sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 || sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4) if (sp->picnum == BOSS4STAYPUT || sp->picnum == BOSS1 || sp->picnum == BOSS2 ||
sp->picnum == BOSS1STAYPUT || sp->picnum == BOSS3 || sp->picnum == BOSS4)
{ {
if (j >= 0 && sprite[j].picnum == RESPAWN) if (j >= 0 && sprite[j].picnum == RESPAWN)
sp->pal = sprite[j].pal; sp->pal = sprite[j].pal;
@ -6595,7 +6614,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
// Display APLAYER sprites with action PSTAND when viewed through // Display APLAYER sprites with action PSTAND when viewed through
// a camera. Not implemented for Lunatic. // a camera. Not implemented for Lunatic.
#ifndef LUNATIC #ifndef LUNATIC
const intptr_t *aplayer_scr = actorscrptr[APLAYER]; const intptr_t *aplayer_scr = g_tile[APLAYER].execPtr;
// [0]=strength, [1]=actionofs, [2]=moveofs // [0]=strength, [1]=actionofs, [2]=moveofs
t_data4 = aplayer_scr[1]; t_data4 = aplayer_scr[1];
@ -6687,7 +6706,7 @@ PALONLY:
break; break;
} }
if (actorscrptr[s->picnum]) if (g_tile[s->picnum].execPtr)
{ {
/* /*
if (ud.angleinterpolation) if (ud.angleinterpolation)
@ -7969,6 +7988,7 @@ FAKE_F3:
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
KB_ClearKeysDown(); KB_ClearKeysDown();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks();
G_LoadPlayerMaybeMulti(g_lastSaveSlot); G_LoadPlayerMaybeMulti(g_lastSaveSlot);
} }

View file

@ -327,9 +327,9 @@ extern char forcegl;
#define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536) #define gametextscaled(x,y,t,s,dabits) G_PrintGameText(1,STARTALPHANUM, x,y,t,s,0,dabits,0, 0, xdim-1, ydim-1, 65536)
#define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536) #define gametextpal(x,y,t,s,p) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,26,0, 0, xdim-1, ydim-1, 65536)
#define gametextpalbits(x,y,t,s,p,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536) #define gametextpalbits(x,y,t,s,p,dabits) G_PrintGameText(0,STARTALPHANUM, x,y,t,s,p,dabits,0, 0, xdim-1, ydim-1, 65536)
#define A_CheckSpriteFlags(iActor, iType) (((SpriteFlags[sprite[iActor].picnum]^actor[iActor].flags) & iType) != 0) #define A_CheckSpriteFlags(iActor, iType) (((g_tile[sprite[iActor].picnum].flags^actor[iActor].flags) & iType) != 0)
// (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots) // (unsigned)iPicnum check: AMC TC Rusty Nails, bayonet MG alt. fire, iPicnum == -1 (via aplWeaponShoots)
#define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (SpriteFlags[iPicnum] & iType) != 0) #define A_CheckSpriteTileFlags(iPicnum, iType) (((unsigned)iPicnum < MAXTILES) && (g_tile[iPicnum].flags & iType) != 0)
#define G_EnterText(x, y, t, dalen, c) _EnterText(0,x,y,t,dalen,c) #define G_EnterText(x, y, t, dalen, c) _EnterText(0,x,y,t,dalen,c)
#define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c) #define Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c)
#define S_StopSound(num) S_StopEnvSound(num, -1) #define S_StopSound(num) S_StopEnvSound(num, -1)

View file

@ -148,8 +148,6 @@ int32_t g_iWallVarID=-1;
int32_t g_iPlayerVarID=-1; int32_t g_iPlayerVarID=-1;
int32_t g_iActorVarID=-1; int32_t g_iActorVarID=-1;
intptr_t *actorLoadEventScrptr[MAXTILES];
intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
static intptr_t *g_parsingEventPtr=NULL; static intptr_t *g_parsingEventPtr=NULL;
@ -1226,8 +1224,8 @@ static int32_t C_SetScriptSize(int32_t newsize)
else scriptptrs[i] = 0; else scriptptrs[i] = 0;
} }
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_FWD_NON0); G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0);
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_FWD_NON0); G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0);
G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_FWD_NON0); G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_FWD_NON0);
initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t)); initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t));
@ -1279,8 +1277,8 @@ static int32_t C_SetScriptSize(int32_t newsize)
script[i] = j; script[i] = j;
} }
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0);
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0);
G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_BACK_NON0); G_Util_PtrToIdx(apScriptGameEvent, MAXGAMEEVENTS, script, P2I_BACK_NON0);
Bfree(scriptptrs); Bfree(scriptptrs);
@ -2752,15 +2750,21 @@ static int32_t C_ParseCommand(int32_t loop)
if (tw == CON_EVENTLOADACTOR) if (tw == CON_EVENTLOADACTOR)
{ {
actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr; g_tile[*g_scriptPtr].loadPtr = g_parsingActorPtr;
g_checkingIfElse = 0; g_checkingIfElse = 0;
continue; continue;
} }
actorscrptr[*g_scriptPtr] = g_parsingActorPtr; g_tile[*g_scriptPtr].execPtr = g_parsingActorPtr;
if (tw == CON_USERACTOR) if (tw == CON_USERACTOR)
ActorType[*g_scriptPtr] = j; {
if (j & 1)
g_tile[*g_scriptPtr].flags |= SPRITE_BADGUY;
if (j & 2)
g_tile[*g_scriptPtr].flags |= SPRITE_BADGUYSTAYPUT;
}
for (j=0; j<4; j++) for (j=0; j<4; j++)
{ {
@ -4016,65 +4020,65 @@ static int32_t C_ParseCommand(int32_t loop)
switch (y) switch (y)
{ {
case PROJ_WORKSLIKE: case PROJ_WORKSLIKE:
DefaultProjectileData[j].workslike = ProjectileData[j].workslike = z; break; g_tile[j].defproj.workslike = g_tile[j].proj.workslike = z; break;
case PROJ_SPAWNS: case PROJ_SPAWNS:
DefaultProjectileData[j].spawns = ProjectileData[j].spawns = z; break; g_tile[j].defproj.spawns = g_tile[j].proj.spawns = z; break;
case PROJ_SXREPEAT: case PROJ_SXREPEAT:
DefaultProjectileData[j].sxrepeat = ProjectileData[j].sxrepeat = z; break; g_tile[j].defproj.sxrepeat = g_tile[j].proj.sxrepeat = z; break;
case PROJ_SYREPEAT: case PROJ_SYREPEAT:
DefaultProjectileData[j].syrepeat = ProjectileData[j].syrepeat = z; break; g_tile[j].defproj.syrepeat = g_tile[j].proj.syrepeat = z; break;
case PROJ_SOUND: case PROJ_SOUND:
DefaultProjectileData[j].sound = ProjectileData[j].sound = z; break; g_tile[j].defproj.sound = g_tile[j].proj.sound = z; break;
case PROJ_ISOUND: case PROJ_ISOUND:
DefaultProjectileData[j].isound = ProjectileData[j].isound = z; break; g_tile[j].defproj.isound = g_tile[j].proj.isound = z; break;
case PROJ_VEL: case PROJ_VEL:
DefaultProjectileData[j].vel = ProjectileData[j].vel = z; break; g_tile[j].defproj.vel = g_tile[j].proj.vel = z; break;
case PROJ_EXTRA: case PROJ_EXTRA:
DefaultProjectileData[j].extra = ProjectileData[j].extra = z; break; g_tile[j].defproj.extra = g_tile[j].proj.extra = z; break;
case PROJ_DECAL: case PROJ_DECAL:
DefaultProjectileData[j].decal = ProjectileData[j].decal = z; break; g_tile[j].defproj.decal = g_tile[j].proj.decal = z; break;
case PROJ_TRAIL: case PROJ_TRAIL:
DefaultProjectileData[j].trail = ProjectileData[j].trail = z; break; g_tile[j].defproj.trail = g_tile[j].proj.trail = z; break;
case PROJ_TXREPEAT: case PROJ_TXREPEAT:
DefaultProjectileData[j].txrepeat = ProjectileData[j].txrepeat = z; break; g_tile[j].defproj.txrepeat = g_tile[j].proj.txrepeat = z; break;
case PROJ_TYREPEAT: case PROJ_TYREPEAT:
DefaultProjectileData[j].tyrepeat = ProjectileData[j].tyrepeat = z; break; g_tile[j].defproj.tyrepeat = g_tile[j].proj.tyrepeat = z; break;
case PROJ_TOFFSET: case PROJ_TOFFSET:
DefaultProjectileData[j].toffset = ProjectileData[j].toffset = z; break; g_tile[j].defproj.toffset = g_tile[j].proj.toffset = z; break;
case PROJ_TNUM: case PROJ_TNUM:
DefaultProjectileData[j].tnum = ProjectileData[j].tnum = z; break; g_tile[j].defproj.tnum = g_tile[j].proj.tnum = z; break;
case PROJ_DROP: case PROJ_DROP:
DefaultProjectileData[j].drop = ProjectileData[j].drop = z; break; g_tile[j].defproj.drop = g_tile[j].proj.drop = z; break;
case PROJ_CSTAT: case PROJ_CSTAT:
DefaultProjectileData[j].cstat = ProjectileData[j].cstat = z; break; g_tile[j].defproj.cstat = g_tile[j].proj.cstat = z; break;
case PROJ_CLIPDIST: case PROJ_CLIPDIST:
DefaultProjectileData[j].clipdist = ProjectileData[j].clipdist = z; break; g_tile[j].defproj.clipdist = g_tile[j].proj.clipdist = z; break;
case PROJ_SHADE: case PROJ_SHADE:
DefaultProjectileData[j].shade = ProjectileData[j].shade = z; break; g_tile[j].defproj.shade = g_tile[j].proj.shade = z; break;
case PROJ_XREPEAT: case PROJ_XREPEAT:
DefaultProjectileData[j].xrepeat = ProjectileData[j].xrepeat = z; break; g_tile[j].defproj.xrepeat = g_tile[j].proj.xrepeat = z; break;
case PROJ_YREPEAT: case PROJ_YREPEAT:
DefaultProjectileData[j].yrepeat = ProjectileData[j].yrepeat = z; break; g_tile[j].defproj.yrepeat = g_tile[j].proj.yrepeat = z; break;
case PROJ_PAL: case PROJ_PAL:
DefaultProjectileData[j].pal = ProjectileData[j].pal = z; break; g_tile[j].defproj.pal = g_tile[j].proj.pal = z; break;
case PROJ_EXTRA_RAND: case PROJ_EXTRA_RAND:
DefaultProjectileData[j].extra_rand = ProjectileData[j].extra_rand = z; break; g_tile[j].defproj.extra_rand = g_tile[j].proj.extra_rand = z; break;
case PROJ_HITRADIUS: case PROJ_HITRADIUS:
DefaultProjectileData[j].hitradius = ProjectileData[j].hitradius = z; break; g_tile[j].defproj.hitradius = g_tile[j].proj.hitradius = z; break;
case PROJ_MOVECNT: case PROJ_MOVECNT:
DefaultProjectileData[j].movecnt = ProjectileData[j].movecnt = z; break; g_tile[j].defproj.movecnt = g_tile[j].proj.movecnt = z; break;
case PROJ_OFFSET: case PROJ_OFFSET:
DefaultProjectileData[j].offset = ProjectileData[j].offset = z; break; g_tile[j].defproj.offset = g_tile[j].proj.offset = z; break;
case PROJ_BOUNCES: case PROJ_BOUNCES:
DefaultProjectileData[j].bounces = ProjectileData[j].bounces = z; break; g_tile[j].defproj.bounces = g_tile[j].proj.bounces = z; break;
case PROJ_BSOUND: case PROJ_BSOUND:
DefaultProjectileData[j].bsound = ProjectileData[j].bsound = z; break; g_tile[j].defproj.bsound = g_tile[j].proj.bsound = z; break;
case PROJ_RANGE: case PROJ_RANGE:
DefaultProjectileData[j].range = ProjectileData[j].range = z; break; g_tile[j].defproj.range = g_tile[j].proj.range = z; break;
default: break; default: break;
} }
SpriteFlags[j] |= SPRITE_PROJECTILE; g_tile[j].flags |= SPRITE_PROJECTILE;
continue; continue;
} }
@ -4097,7 +4101,7 @@ static int32_t C_ParseCommand(int32_t loop)
continue; continue;
} }
SpriteFlags[j] = *g_scriptPtr; g_tile[j].flags = *g_scriptPtr;
continue; continue;
} }
@ -4131,19 +4135,19 @@ static int32_t C_ParseCommand(int32_t loop)
switch (tw) switch (tw)
{ {
case CON_SPRITESHADOW: case CON_SPRITESHADOW:
SpriteFlags[*g_scriptPtr] |= SPRITE_SHADOW; g_tile[*g_scriptPtr].flags |= SPRITE_SHADOW;
break; break;
case CON_SPRITENVG: case CON_SPRITENVG:
SpriteFlags[*g_scriptPtr] |= SPRITE_NVG; g_tile[*g_scriptPtr].flags |= SPRITE_NVG;
break; break;
case CON_SPRITENOSHADE: case CON_SPRITENOSHADE:
SpriteFlags[*g_scriptPtr] |= SPRITE_NOSHADE; g_tile[*g_scriptPtr].flags |= SPRITE_NOSHADE;
break; break;
case CON_SPRITENOPAL: case CON_SPRITENOPAL:
SpriteFlags[*g_scriptPtr] |= SPRITE_NOPAL; g_tile[*g_scriptPtr].flags |= SPRITE_NOPAL;
break; break;
case CON_PRECACHE: case CON_PRECACHE:
SpriteCacheList[*g_scriptPtr][0] = j; g_tile[*g_scriptPtr].flags |= SPRITE_CACHE;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; g_scriptPtr--;
i = *g_scriptPtr; i = *g_scriptPtr;
@ -4152,11 +4156,16 @@ static int32_t C_ParseCommand(int32_t loop)
C_ReportError(ERROR_EXCEEDSMAXTILES); C_ReportError(ERROR_EXCEEDSMAXTILES);
g_numCompilerErrors++; g_numCompilerErrors++;
} }
SpriteCacheList[j][1] = i; g_tile[j].cacherange[0] = i;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--; g_scriptPtr--;
i = *g_scriptPtr; i = *g_scriptPtr;
SpriteCacheList[j][2] = i; if ((unsigned)i >= MAXTILES)
{
C_ReportError(ERROR_EXCEEDSMAXTILES);
g_numCompilerErrors++;
}
g_tile[j].cacherange[1] = i;
break; break;
} }
continue; continue;
@ -5716,6 +5725,18 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition(tempbuf, i, LABEL_DEFINE); C_AddDefinition(tempbuf, i, LABEL_DEFINE);
} }
C_AddDefinition("SFLAG_SHADOW", SPRITE_SHADOW, LABEL_DEFINE);
C_AddDefinition("SFLAG_NVG", SPRITE_NVG, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOSHADE", SPRITE_NOSHADE, LABEL_DEFINE);
C_AddDefinition("SFLAG_BADGUY", SPRITE_BADGUY, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOPAL", SPRITE_NOPAL, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOEVENTS", SPRITE_NOEVENTCODE, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOLIGHT", SPRITE_NOLIGHT, LABEL_DEFINE);
C_AddDefinition("SFLAG_USEACTIVATOR", SPRITE_USEACTIVATOR, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOCLIP", SPRITE_NOCLIP, LABEL_DEFINE);
C_AddDefinition("SFLAG_SMOOTHMOVE", SPRITE_SMOOTHMOVE, LABEL_DEFINE);
C_AddDefinition("SFLAG_NOTELEPORT", SPRITE_NOTELEPORT, LABEL_DEFINE);
C_AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE); C_AddDefinition("STR_MAPNAME",STR_MAPNAME,LABEL_DEFINE);
C_AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE); C_AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE);
C_AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE); C_AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE);
@ -5788,9 +5809,10 @@ static void C_InitProjectiles(void)
G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!"); G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!");
for (i=MAXTILES-1; i>=0; i--) for (i=MAXTILES-1; i>=0; i--)
Bmemcpy(&ProjectileData[i],&DefaultProjectile,sizeof(projectile_t)); {
Bmemcpy(&g_tile[i].proj, &DefaultProjectile, sizeof(projectile_t));
Bmemcpy(&DefaultProjectileData[0], &ProjectileData[0], sizeof(ProjectileData)); Bmemcpy(&g_tile[i].defproj, &g_tile[i].proj, sizeof(projectile_t));
}
} }
#pragma pack(pop) #pragma pack(pop)
@ -5882,10 +5904,9 @@ void C_Compile(const char *filenam)
kread(fp,(char *)textptr,fs); kread(fp,(char *)textptr,fs);
kclose(fp); kclose(fp);
Bmemset(actorscrptr, 0, sizeof(actorscrptr)); for (i=MAXTILES-1; i>=0; i--)
Bmemset(actorLoadEventScrptr, 0, sizeof(actorLoadEventScrptr)); Bmemset(&g_tile[i], 0, sizeof(tiledata_t));
Bmemset(ActorType, 0, sizeof(ActorType));
// clearbufbyte(script,sizeof(script),0l); // JBF 20040531: yes? no?
if (script != NULL) if (script != NULL)
Bfree(script); Bfree(script);
@ -5996,7 +6017,7 @@ void C_Compile(const char *filenam)
if (apScriptGameEvent[i]) if (apScriptGameEvent[i])
k++; k++;
for (i=MAXTILES-1; i>=0; i--) for (i=MAXTILES-1; i>=0; i--)
if (actorscrptr[i]) if (g_tile[i].execPtr)
l++; l++;
if (j) initprintf("%d quotes, ", j); if (j) initprintf("%d quotes, ", j);

View file

@ -55,8 +55,6 @@ extern int32_t g_iWallVarID;
extern int32_t g_iPlayerVarID; extern int32_t g_iPlayerVarID;
extern int32_t g_iActorVarID; extern int32_t g_iActorVarID;
extern intptr_t *actorLoadEventScrptr[MAXTILES];
extern intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; extern intptr_t *apScriptGameEvent[MAXGAMEEVENTS];
extern int32_t otherp; extern int32_t otherp;

View file

@ -707,15 +707,12 @@ dead:
} }
else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER) else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER)
{ {
if (actor[vm.g_i].bposz != vm.g_sp->z || ((!g_netServer && ud.multimode < 2) && ud.player_skill < 2)) if (ps->actorsqu == vm.g_i) return;
if (!A_CheckSpriteFlags(vm.g_i, SPRITE_SMOOTHMOVE))
{ {
if ((vm.g_t[0]&1) || ps->actorsqu == vm.g_i) return; if (vm.g_t[0]&1) return;
else daxvel <<= 1; daxvel <<= 1;
}
else
{
if ((vm.g_t[0]&3) || ps->actorsqu == vm.g_i) return;
else daxvel <<= 2;
} }
} }
} }
@ -1352,7 +1349,7 @@ skip_check:
#endif #endif
if ((vm.g_sp->hitag & jumptoplayer) || if ((vm.g_sp->hitag & jumptoplayer) ||
(actorscrptr[vm.g_sp->picnum] && (g_tile[vm.g_sp->picnum].execPtr &&
#ifndef LUNATIC #ifndef LUNATIC
(unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1] (unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1]
#else #else
@ -1937,12 +1934,12 @@ nullquote:
actor[i].flags = 0; actor[i].flags = 0;
sprite[i].hitag = 0; sprite[i].hitag = 0;
if (actorscrptr[sprite[i].picnum]) if (g_tile[sprite[i].picnum].execPtr)
{ {
// offsets // offsets
T5 = *(actorscrptr[sprite[i].picnum]+1); // action T5 = *(g_tile[sprite[i].picnum].execPtr+1); // action
T2 = *(actorscrptr[sprite[i].picnum]+2); // move T2 = *(g_tile[sprite[i].picnum].execPtr+2); // move
sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3); // ai bits sprite[i].hitag = *(g_tile[sprite[i].picnum].execPtr+3); // ai bits
} }
} }
changespritestat(i,j); changespritestat(i,j);
@ -5070,7 +5067,7 @@ void A_LoadActor(int32_t iActor)
vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure
vm.g_t = &actor[vm.g_i].t_data[0]; // Sprite's 'extra' data vm.g_t = &actor[vm.g_i].t_data[0]; // Sprite's 'extra' data
if (actorLoadEventScrptr[vm.g_sp->picnum] == NULL) if (g_tile[vm.g_sp->picnum].loadPtr == NULL)
return; return;
vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE); vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE);
@ -5083,7 +5080,7 @@ void A_LoadActor(int32_t iActor)
return; return;
} }
insptr = actorLoadEventScrptr[vm.g_sp->picnum]; insptr = g_tile[vm.g_sp->picnum].loadPtr;
VM_Execute(1); VM_Execute(1);
insptr = NULL; insptr = NULL;
@ -5163,7 +5160,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
El_CallActor(&g_ElState, vm.g_sp->picnum, iActor, iPlayer, lDist); El_CallActor(&g_ElState, vm.g_sp->picnum, iActor, iPlayer, lDist);
#endif #endif
insptr = 4 + (actorscrptr[vm.g_sp->picnum]); insptr = 4 + (g_tile[vm.g_sp->picnum].execPtr);
VM_Execute(1); VM_Execute(1);
insptr = NULL; insptr = NULL;

View file

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

View file

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

View file

@ -37,6 +37,7 @@ int32_t neartaghitdist,lockclock,g_startArmorAmount;
int32_t g_spriteGravity=176; int32_t g_spriteGravity=176;
actor_t actor[MAXSPRITES]; actor_t actor[MAXSPRITES];
tiledata_t g_tile[MAXTILES];
int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize=64; int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize=64;
animwalltype animwall[MAXANIMWALLS]; animwalltype animwall[MAXANIMWALLS];
@ -110,9 +111,8 @@ int32_t vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRes
intptr_t *g_scriptPtr,*insptr; intptr_t *g_scriptPtr,*insptr;
int32_t *labelcode, *labeltype; int32_t *labelcode, *labeltype;
int32_t g_numLabels,g_numDefaultLabels; int32_t g_numLabels,g_numDefaultLabels;
intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr; intptr_t *g_parsingActorPtr;
char *label; char *label;
char ActorType[MAXTILES];
intptr_t *script = NULL; intptr_t *script = NULL;
int32_t g_scriptSize = 1048576; int32_t g_scriptSize = 1048576;
@ -171,9 +171,7 @@ int32_t oldipos[MAXINTERPOLATIONS];
int32_t bakipos[MAXINTERPOLATIONS]; int32_t bakipos[MAXINTERPOLATIONS];
int32_t *curipos[MAXINTERPOLATIONS]; int32_t *curipos[MAXINTERPOLATIONS];
int32_t SpriteFlags[MAXTILES]; projectile_t SpriteProjectile[MAXSPRITES];
projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES];
char CheatKeys[2] = { sc_D, sc_N }; char CheatKeys[2] = { sc_D, sc_N };
char setupfilename[BMAX_PATH]= SETUPFILENAME; char setupfilename[BMAX_PATH]= SETUPFILENAME;

View file

@ -44,10 +44,10 @@ G_EXTERN int32_t connectpoint2[MAXPLAYERS];
G_EXTERN const char *s_buildRev; G_EXTERN const char *s_buildRev;
G_EXTERN DukeStatus_t sbar; G_EXTERN DukeStatus_t sbar;
G_EXTERN actor_t actor[MAXSPRITES]; G_EXTERN actor_t actor[MAXSPRITES];
G_EXTERN tiledata_t g_tile[MAXTILES];
G_EXTERN animwalltype animwall[MAXANIMWALLS]; G_EXTERN animwalltype animwall[MAXANIMWALLS];
G_EXTERN char *ScriptQuotes[MAXQUOTES],*ScriptQuoteRedefinitions[MAXQUOTES]; G_EXTERN char *ScriptQuotes[MAXQUOTES],*ScriptQuoteRedefinitions[MAXQUOTES];
G_EXTERN char *label; G_EXTERN char *label;
G_EXTERN char ActorType[MAXTILES];
G_EXTERN char CheatKeys[2]; G_EXTERN char CheatKeys[2];
G_EXTERN char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; G_EXTERN char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH];
G_EXTERN char EpisodeNames[MAXVOLUMES][33]; G_EXTERN char EpisodeNames[MAXVOLUMES][33];
@ -86,7 +86,6 @@ G_EXTERN int16_t neartagsector,neartagwall,neartagsprite;
G_EXTERN int32_t *animateptr[MAXANIMATES]; G_EXTERN int32_t *animateptr[MAXANIMATES];
G_EXTERN int32_t *curipos[MAXINTERPOLATIONS]; G_EXTERN int32_t *curipos[MAXINTERPOLATIONS];
G_EXTERN int32_t GametypeFlags[MAXGAMETYPES]; G_EXTERN int32_t GametypeFlags[MAXGAMETYPES];
G_EXTERN int32_t SpriteFlags[MAXTILES];
G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount; G_EXTERN int32_t animategoal[MAXANIMATES],animatevel[MAXANIMATES],g_animateCount;
G_EXTERN int32_t bakipos[MAXINTERPOLATIONS]; G_EXTERN int32_t bakipos[MAXINTERPOLATIONS];
G_EXTERN int32_t cloudtotalclock; G_EXTERN int32_t cloudtotalclock;
@ -120,14 +119,14 @@ G_EXTERN int32_t playerswhenstarted;
G_EXTERN int32_t screenpeek; G_EXTERN int32_t screenpeek;
G_EXTERN int32_t startofdynamicinterpolations; G_EXTERN int32_t startofdynamicinterpolations;
G_EXTERN int32_t vel,svel,angvel,horiz,ototalclock,g_actorRespawnTime; G_EXTERN int32_t vel,svel,angvel,horiz,ototalclock,g_actorRespawnTime;
G_EXTERN intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr; G_EXTERN intptr_t *g_parsingActorPtr;
G_EXTERN intptr_t *g_scriptPtr,*insptr; G_EXTERN intptr_t *g_scriptPtr,*insptr;
G_EXTERN int32_t *labelcode,*labeltype; G_EXTERN int32_t *labelcode,*labeltype;
G_EXTERN intptr_t *script; G_EXTERN intptr_t *script;
G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
G_EXTERN playerdata_t g_player[MAXPLAYERS]; G_EXTERN playerdata_t g_player[MAXPLAYERS];
G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; G_EXTERN playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
G_EXTERN projectile_t ProjectileData[MAXTILES],DefaultProjectileData[MAXTILES],SpriteProjectile[MAXSPRITES]; G_EXTERN projectile_t SpriteProjectile[MAXSPRITES];
G_EXTERN sound_t g_sounds[MAXSOUNDS]; G_EXTERN sound_t g_sounds[MAXSOUNDS];
G_EXTERN uint32_t everyothertime; G_EXTERN uint32_t everyothertime;
G_EXTERN uint32_t g_moveThingsCount; G_EXTERN uint32_t g_moveThingsCount;

View file

@ -1583,6 +1583,7 @@ void M_DisplayMenus(void)
KB_FlushKeyboardQueue(); KB_FlushKeyboardQueue();
KB_ClearKeysDown(); KB_ClearKeysDown();
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks();
G_LoadPlayerMaybeMulti(g_lastSaveSlot); G_LoadPlayerMaybeMulti(g_lastSaveSlot);
} }
@ -2029,22 +2030,22 @@ cheat_for_port_credits:
minitext(161-(Bstrlen(p)<<1), 59+10-l, p, 4, 10+16+128); minitext(161-(Bstrlen(p)<<1), 59+10-l, p, 4, 10+16+128);
minitext(160-(Bstrlen(p)<<1), 58+10-l, p, 8, 10+16+128); minitext(160-(Bstrlen(p)<<1), 58+10-l, p, 8, 10+16+128);
mgametext(160,78-l,"Engine and Game Maintenance",0,2+8+16); mgametext(160,78-l,"Additional Engine and Game Programming",0,2+8+16);
p = "Philipp \"Helixhorned\" Kutin"; p = "Philipp \"Helixhorned\" Kutin";
minitext(161-(Bstrlen(p)<<1), 79+10-l, p, 4, 10+16+128); minitext(161-(Bstrlen(p)<<1), 79+10-l, p, 4, 10+16+128);
minitext(160-(Bstrlen(p)<<1), 78+10-l, p, 8, 10+16+128); minitext(160-(Bstrlen(p)<<1), 78+10-l, p, 8, 10+16+128);
mgametext(160,98-l,"Original \"JFDuke3D\" Porting Work",0,2+8+16); mgametext(160,98-l,"\"JFDuke3D\" and \"JFBuild\" code",0,2+8+16);
p = "Jonathon \"JonoF\" Fowler"; p = "Jonathon \"JonoF\" Fowler";
minitext(161-(Bstrlen(p)<<1), 99+10-l, p, 4, 10+16+128); minitext(161-(Bstrlen(p)<<1), 99+10-l, p, 4, 10+16+128);
minitext(160-(Bstrlen(p)<<1), 98+10-l, p, 8, 10+16+128); minitext(160-(Bstrlen(p)<<1), 98+10-l, p, 8, 10+16+128);
mgametext(160,118-l,"DOS \"EDuke\" Code",0,2+8+16); mgametext(160,118-l,"Legacy \"NAM\", \"WW2GI\" and \"EDuke\" Code",0,2+8+16);
p = "Matt \"Matteus\" Saettler"; p = "Matt \"Matteus\" Saettler";
minitext(161-(Bstrlen(p)<<1), 119+10-l, p, 4, 10+16+128); minitext(161-(Bstrlen(p)<<1), 119+10-l, p, 4, 10+16+128);
minitext(160-(Bstrlen(p)<<1), 118+10-l, p, 8, 10+16+128); minitext(160-(Bstrlen(p)<<1), 118+10-l, p, 8, 10+16+128);
mgametext(160,138-l,"BUILD Engine and Polymost Renderer",0,2+8+16); mgametext(160,138-l,"Core BUILD Engine functionality",0,2+8+16);
p = "Ken \"Awesoken\" Silverman"; p = "Ken \"Awesoken\" Silverman";
minitext(161-(Bstrlen(p)<<1), 139+10-l, p, 4, 10+16+128); minitext(161-(Bstrlen(p)<<1), 139+10-l, p, 4, 10+16+128);
minitext(160-(Bstrlen(p)<<1), 138+10-l, p, 8, 10+16+128); minitext(160-(Bstrlen(p)<<1), 138+10-l, p, 8, 10+16+128);

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

View file

@ -43,7 +43,6 @@ extern El_State g_ElState;
static int32_t g_whichPalForPlayer = 9; static int32_t g_whichPalForPlayer = 9;
int32_t g_numRealPalettes; int32_t g_numRealPalettes;
int16_t SpriteCacheList[MAXTILES][3];
static uint8_t precachehightile[2][MAXTILES>>3]; static uint8_t precachehightile[2][MAXTILES>>3];
static int32_t g_precacheCount; static int32_t g_precacheCount;
@ -91,8 +90,8 @@ static void G_CacheSpriteNum(int32_t i)
maxc = 1; maxc = 1;
if (SpriteCacheList[PN][0] == PN) if (A_CheckSpriteTileFlags(PN, SPRITE_CACHE) && g_tile[PN].cacherange[1])
for (j = PN; j <= SpriteCacheList[PN][1]; j++) for (j = g_tile[PN].cacherange[0]; j <= g_tile[PN].cacherange[1]; j++)
tloadtile(j,1); tloadtile(j,1);
switch (DYNAMICTILEMAP(PN)) switch (DYNAMICTILEMAP(PN))
@ -227,10 +226,11 @@ static void G_PrecacheSprites(void)
for (i=0; i<MAXTILES; i++) for (i=0; i<MAXTILES; i++)
{ {
if (SpriteFlags[i] & SPRITE_PROJECTILE) if (g_tile[i].flags & SPRITE_PROJECTILE)
tloadtile(i,1); tloadtile(i,1);
if (SpriteCacheList[i][0] == i && SpriteCacheList[i][2])
for (j = i; j <= SpriteCacheList[i][1]; j++) if (A_CheckSpriteTileFlags(i, SPRITE_CACHE) && g_tile[i].cacherange[1])
for (j = g_tile[i].cacherange[0]; j <= g_tile[i].cacherange[1]; j++)
tloadtile(j,1); tloadtile(j,1);
} }
tloadtile(BOTTOMSTATUSBAR,1); tloadtile(BOTTOMSTATUSBAR,1);
@ -1059,7 +1059,8 @@ static void premap_setup_fixed_sprites(void)
// TRIPBOMB uses t_data[7] for its own purposes. Wouldn't be // TRIPBOMB uses t_data[7] for its own purposes. Wouldn't be
// too useful with moving sectors anyway // too useful with moving sectors anyway
if ((FIXSPR_STATNUMP(sprite[j].statnum) && sprite[j].picnum!=TRIPBOMB) || if ((FIXSPR_STATNUMP(sprite[j].statnum) && sprite[j].picnum!=TRIPBOMB) ||
((sprite[j].statnum==STAT_ACTOR || sprite[j].statnum==STAT_ZOMBIEACTOR) && (ActorType[sprite[j].picnum]&4))) ((sprite[j].statnum==STAT_ACTOR || sprite[j].statnum==STAT_ZOMBIEACTOR) &&
A_CheckSpriteTileFlags(sprite[j].picnum, SPRITE_BADGUY)))
{ {
pivot = i; pivot = i;
if (sprite[i].lotag==0) if (sprite[i].lotag==0)

View file

@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern const char pow2char[]; extern const char pow2char[];
extern int16_t SpriteCacheList[MAXTILES][3];
extern int32_t g_levelTextTime; extern int32_t g_levelTextTime;
extern int32_t g_numRealPalettes; extern int32_t g_numRealPalettes;
extern int32_t voting,vote_map,vote_episode; extern int32_t voting,vote_map,vote_episode;

View file

@ -58,6 +58,33 @@ void G_Util_PtrToIdx(void *ptr, uint32_t len, const void *base, int32_t mode)
} }
} }
void G_Util_PtrToIdx2(void *ptr, uint32_t len, size_t ofs, const void *base, int32_t mode)
{
uint32_t i;
uint8_t *iptr = (uint8_t *)ptr;
intptr_t ibase = (intptr_t)base;
int32_t back_p = mode&P2I_BACK_BIT;
int32_t onlynon0_p = mode&P2I_ONLYNON0_BIT;
// TODO: convert to proper offsets/indices for (a step towards) cross-
// compatibility between 32- and 64-bit systems in the netplay.
// REMEMBER to bump BYTEVERSION then.
for (i=0; i<len; i++)
{
// WARNING: C std doesn't say that bit pattern of NULL is necessarily 0!
if (!onlynon0_p || *(intptr_t *)iptr)
{
if (!back_p)
*(intptr_t *)iptr -= ibase;
else
*(intptr_t *)iptr += ibase;
}
iptr += ofs;
}
}
// TODO: sync with TROR special interpolations? (e.g. upper floor of subway) // TODO: sync with TROR special interpolations? (e.g. upper floor of subway)
void G_ResetInterpolations(void) void G_ResetInterpolations(void)
{ {
@ -934,10 +961,7 @@ static const dataspec_t svgm_secwsp[] =
#ifdef USE_OPENGL #ifdef USE_OPENGL
{ DS_SAVEFN|DS_LOADFN, (void *)&sv_postspriteext, 0, 1 }, { DS_SAVEFN|DS_LOADFN, (void *)&sv_postspriteext, 0, 1 },
#endif #endif
{ DS_NOCHK, &SpriteFlags[0], sizeof(SpriteFlags[0]), MAXTILES },
{ DS_NOCHK, &SpriteCacheList[0], sizeof(SpriteCacheList[0]), MAXTILES },
{ 0, &DynamicTileMap[0], sizeof(DynamicTileMap[0]), MAXTILES }, // NOCHK? { 0, &DynamicTileMap[0], sizeof(DynamicTileMap[0]), MAXTILES }, // NOCHK?
{ DS_NOCHK, &ActorType[0], sizeof(uint8_t), MAXTILES },
{ DS_NOCHK, &g_numCyclers, sizeof(g_numCyclers), 1 }, { DS_NOCHK, &g_numCyclers, sizeof(g_numCyclers), 1 },
{ DS_CNT(g_numCyclers), &cyclers[0][0], sizeof(cyclers[0]), (intptr_t)&g_numCyclers }, { DS_CNT(g_numCyclers), &cyclers[0][0], sizeof(cyclers[0]), (intptr_t)&g_numCyclers },
{ DS_NOCHK, &g_numAnimWalls, sizeof(g_numAnimWalls), 1 }, { DS_NOCHK, &g_numAnimWalls, sizeof(g_numAnimWalls), 1 },
@ -947,8 +971,6 @@ static const dataspec_t svgm_secwsp[] =
{ DS_NOCHK, &g_mirrorSector[0], sizeof(g_mirrorSector[0]), sizeof(g_mirrorSector)/sizeof(g_mirrorSector[0]) }, { DS_NOCHK, &g_mirrorSector[0], sizeof(g_mirrorSector[0]), sizeof(g_mirrorSector)/sizeof(g_mirrorSector[0]) },
// projectiles // projectiles
{ 0, &SpriteProjectile[0], sizeof(projectile_t), MAXSPRITES }, { 0, &SpriteProjectile[0], sizeof(projectile_t), MAXSPRITES },
{ 0, &ProjectileData[0], sizeof(projectile_t), MAXTILES },
{ DS_NOCHK, &DefaultProjectileData[0], sizeof(projectile_t), MAXTILES },
{ 0, &everyothertime, sizeof(everyothertime), 1 }, { 0, &everyothertime, sizeof(everyothertime), 1 },
{ DS_END, 0, 0, 0 } { DS_END, 0, 0, 0 }
}; };
@ -961,10 +983,9 @@ static const dataspec_t svgm_script[] =
{ DS_DYNAMIC|DS_CNT(savegame_bitptrsize)|DS_NOCHK, &bitptr, sizeof(bitptr[0]), (intptr_t)&savegame_bitptrsize }, { 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 }, { DS_SAVEFN|DS_NOCHK, (void *)&sv_prescriptsave_once, 0, 1 },
{ DS_NOCHK, &actorscrptr[0], sizeof(actorscrptr[0]), MAXTILES }, { 0, &g_tile[0], sizeof(tiledata_t), MAXTILES },
{ DS_LOADFN|DS_NOCHK, (void *)&sv_prescriptload_once, 0, 1 }, { 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_DYNAMIC|DS_CNT(g_scriptSize)|DS_NOCHK, &script, sizeof(script[0]), (intptr_t)&g_scriptSize },
{ DS_NOCHK, &actorLoadEventScrptr[0], sizeof(actorLoadEventScrptr[0]), MAXTILES },
// { DS_NOCHK, &apScriptGameEvent[0], sizeof(apScriptGameEvent[0]), MAXGAMEEVENTS }, // { DS_NOCHK, &apScriptGameEvent[0], sizeof(apScriptGameEvent[0]), MAXGAMEEVENTS },
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_postscript_once, 0, 1 }, { DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_postscript_once, 0, 1 },
@ -1477,8 +1498,8 @@ static void sv_prescriptsave_once()
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
script[i] = (intptr_t *)script[i] - script; script[i] = (intptr_t *)script[i] - script;
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_FWD_NON0); G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0);
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_FWD_NON0); G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0);
} }
static void sv_prescriptload_once() static void sv_prescriptload_once()
{ {
@ -1490,8 +1511,8 @@ static void sv_postscript_once()
{ {
int32_t i; int32_t i;
G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0);
G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0); G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0);
for (i=0; i<g_scriptSize; i++) for (i=0; i<g_scriptSize; i++)
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7))) if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))

View file

@ -81,5 +81,6 @@ enum
P2I_BACK_NON0 = 1+2, P2I_BACK_NON0 = 1+2,
}; };
void G_Util_PtrToIdx(void *ptr, uint32_t len, const void *base, int32_t mode); void G_Util_PtrToIdx(void *ptr, uint32_t len, const void *base, int32_t mode);
void G_Util_PtrToIdx2(void *ptr, uint32_t len, size_t ofs, const void *base, int32_t mode);
#endif #endif

View file

@ -2123,7 +2123,7 @@ void A_DamageObject(int32_t i,int32_t sn)
case FUELPOD__STATIC: case FUELPOD__STATIC:
case SOLARPANNEL__STATIC: case SOLARPANNEL__STATIC:
case ANTENNA__STATIC: case ANTENNA__STATIC:
if (sprite[sn].extra != *actorscrptr[SHOTSPARK1]) if (sprite[sn].extra != *g_tile[SHOTSPARK1].execPtr)
{ {
for (j=15; j>0; j--) for (j=15; j>0; j--)
A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64, A_InsertSprite(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(krand()&15),-8,64,64,
@ -2363,7 +2363,7 @@ void A_DamageObject(int32_t i,int32_t sn)
if ((PN != DRONE) && (PN != ROTATEGUN) && (PN != COMMANDER) && (PN < GREENSLIME || PN > GREENSLIME+7)) if ((PN != DRONE) && (PN != ROTATEGUN) && (PN != COMMANDER) && (PN < GREENSLIME || PN > GREENSLIME+7))
if (sprite[sn].picnum != FREEZEBLAST) if (sprite[sn].picnum != FREEZEBLAST)
if (ActorType[PN] == 0) if (!A_CheckSpriteTileFlags(PN, SPRITE_BADGUY))
{ {
j = A_Spawn(sn,JIBS6); j = A_Spawn(sn,JIBS6);
if (sprite[sn].pal == 6) if (sprite[sn].pal == 6)

View file

@ -25,9 +25,11 @@
#ifndef _XDELTA3_H_ #ifndef _XDELTA3_H_
#define _XDELTA3_H_ #define _XDELTA3_H_
/*
#define _POSIX_SOURCE #define _POSIX_SOURCE
#define _ISOC99_SOURCE #define _ISOC99_SOURCE
#define _C99_SOURCE #define _C99_SOURCE
*/
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>