diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index a8c91a69c..2b4deeb37 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -341,7 +341,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype) clipdist = 1024; else if (spr->picnum == LIZMAN) clipdist = 292; - else if (ActorType[spr->picnum]&3) + else if (A_CheckSpriteTileFlags(spr->picnum, SPRITE_BADGUY)) clipdist = spr->clipdist<<2; else 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) { 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)) { 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; } - if (actorscrptr[sprite[i].picnum]) + if (g_tile[sprite[i].picnum].execPtr) A_Execute(i,s->yvel,otherx); if (g_netServer || ud.multimode > 1) @@ -2410,7 +2411,7 @@ CLEAR_THE_BOLT: case STEAM__STATIC: case CEILINGSTEAM__STATIC: case WATERBUBBLEMAKER__STATIC: - if (!actorscrptr[sprite[i].picnum]) + if (!g_tile[sprite[i].picnum].execPtr) goto BOLT; { int32_t p = A_FindPlayer(s, &x); @@ -2796,7 +2797,7 @@ ACTOR_STATIC void G_MoveWeapons(void) if (proj->workslike & PROJECTILE_HITSCAN) { - if (!actorscrptr[sprite[i].picnum]) + if (!g_tile[sprite[i].picnum].execPtr) goto BOLT; { int32_t p = A_FindPlayer(s,&x); @@ -3116,7 +3117,7 @@ COOLEXPLOSION: goto BOLT; case SHOTSPARK1__STATIC: - if (!actorscrptr[sprite[i].picnum]) + if (!g_tile[sprite[i].picnum].execPtr) goto BOLT; { 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; { int32_t p = A_FindPlayer(s,&x); @@ -5309,7 +5310,7 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5 case TRANSPORTERSTAR__STATIC: case TRANSPORTERBEAM__STATIC: { - if (!actorscrptr[sprite[i].picnum]) + if (!g_tile[sprite[i].picnum].execPtr) goto BOLT; { 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 //stuff to the value from names.h so handling separately if (A_CheckSpriteTileFlags(pn, SPRITE_BADGUY) || - (ActorType[pn]&3) || (pn >= GREENSLIME && pn <= GREENSLIME+7)) return 1; diff --git a/polymer/eduke32/source/actors.h b/polymer/eduke32/source/actors.h index 1cbb2e984..a0f6e298c 100644 --- a/polymer/eduke32/source/actors.h +++ b/polymer/eduke32/source/actors.h @@ -165,6 +165,20 @@ typedef struct { int16_t actorstayput, dispicnum, shootzvel, cgg; // 8b } 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) enum sflags_t { @@ -183,6 +197,8 @@ enum sflags_t { SPRITE_NOFLOORSHADOW = 0x00001000, // for temp. internal use, per-tile flag not checked SPRITE_SMOOTHMOVE = 0x00002000, SPRITE_NOTELEPORT = 0x00004000, + SPRITE_BADGUYSTAYPUT = 0x00008000, + SPRITE_CACHE = 0x00010000, }; // custom projectiles @@ -210,19 +226,13 @@ enum pflags_t { PROJECTILE_ACCURATE = 0x00100000, }; +extern tiledata_t g_tile[MAXTILES]; 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 g_noEnemies; extern int32_t otherp; extern int32_t ticrandomseed; -extern intptr_t *actorLoadEventScrptr[MAXTILES]; -extern intptr_t *actorscrptr[MAXTILES]; extern intptr_t *g_parsingActorPtr; -extern projectile_t DefaultProjectileData[MAXTILES]; -extern projectile_t ProjectileData[MAXTILES]; extern projectile_t SpriteProjectile[MAXSPRITES]; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 81d69b5a6..0158720c1 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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; - if (actorscrptr[s_pn]) + if (g_tile[s_pn].execPtr) { - s->extra = *actorscrptr[s_pn]; - T5 = *(actorscrptr[s_pn]+1); - T2 = *(actorscrptr[s_pn]+2); + s->extra = *g_tile[s_pn].execPtr; + T5 = *(g_tile[s_pn].execPtr+1); + T2 = *(g_tile[s_pn].execPtr+2); #ifdef LUNATIC set_action_members(i); set_move_members(i); #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)); @@ -4107,17 +4107,17 @@ int32_t A_Spawn(int32_t j, int32_t pn) if (CS&1) CS |= 256; - if (actorscrptr[s]) + if (g_tile[s].execPtr) { - SH = *(actorscrptr[s]); - T5 = *(actorscrptr[s]+1); - T2 = *(actorscrptr[s]+2); + SH = *(g_tile[s].execPtr); + T5 = *(g_tile[s].execPtr+1); + T2 = *(g_tile[s].execPtr+2); #ifdef LUNATIC set_action_members(i); set_move_members(i); #endif - if (*(actorscrptr[s]+3) && SHT == 0) - SHT = *(actorscrptr[s]+3); + if (*(g_tile[s].execPtr+3) && SHT == 0) + SHT = *(g_tile[s].execPtr+3); } else T2 = T5 = 0; } @@ -4162,7 +4162,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) else switch (DYNAMICTILEMAP(sp->picnum)) { default: - if (actorscrptr[sp->picnum]) + if (g_tile[sp->picnum].execPtr) { 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) sp->xrepeat = sp->yrepeat = 1; - if (ActorType[sp->picnum] & 3) + if (A_CheckSpriteTileFlags(sp->picnum, SPRITE_BADGUY)) { if (ud.monsters_off == 1) { @@ -4186,7 +4186,7 @@ int32_t A_Spawn(int32_t j, int32_t pn) A_Fall(i); - if (ActorType[sp->picnum] & 2) + if (A_CheckSpriteTileFlags(sp->picnum, SPRITE_BADGUYSTAYPUT)) actor[i].actorstayput = sp->sectnum; g_player[myconnectindex].ps->max_actors_killed++; @@ -5044,8 +5044,27 @@ int32_t A_Spawn(int32_t j, int32_t pn) 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) 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 // a camera. Not implemented for 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 t_data4 = aplayer_scr[1]; @@ -6687,7 +6706,7 @@ PALONLY: break; } - if (actorscrptr[s->picnum]) + if (g_tile[s->picnum].execPtr) { /* if (ud.angleinterpolation) @@ -7969,6 +7988,7 @@ FAKE_F3: KB_FlushKeyboardQueue(); KB_ClearKeysDown(); FX_StopAllSounds(); + S_ClearSoundLocks(); G_LoadPlayerMaybeMulti(g_lastSaveSlot); } diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 78664bf7f..65296b8cf 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -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 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 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) -#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 Net_EnterText(x, y, t, dalen, c) _EnterText(1,x,y,t,dalen,c) #define S_StopSound(num) S_StopEnvSound(num, -1) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index c9bb0ecc6..20bf03501 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -148,8 +148,6 @@ int32_t g_iWallVarID=-1; int32_t g_iPlayerVarID=-1; int32_t g_iActorVarID=-1; -intptr_t *actorLoadEventScrptr[MAXTILES]; - intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; static intptr_t *g_parsingEventPtr=NULL; @@ -1226,8 +1224,8 @@ static int32_t C_SetScriptSize(int32_t newsize) else scriptptrs[i] = 0; } - G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_FWD_NON0); - G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_FWD_NON0); + G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), 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); 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; } - G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_BACK_NON0); - G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0); + G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), 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); Bfree(scriptptrs); @@ -2752,15 +2750,21 @@ static int32_t C_ParseCommand(int32_t loop) if (tw == CON_EVENTLOADACTOR) { - actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr; + g_tile[*g_scriptPtr].loadPtr = g_parsingActorPtr; g_checkingIfElse = 0; continue; } - actorscrptr[*g_scriptPtr] = g_parsingActorPtr; + g_tile[*g_scriptPtr].execPtr = g_parsingActorPtr; 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++) { @@ -4016,65 +4020,65 @@ static int32_t C_ParseCommand(int32_t loop) switch (y) { 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: - DefaultProjectileData[j].spawns = ProjectileData[j].spawns = z; break; + g_tile[j].defproj.spawns = g_tile[j].proj.spawns = z; break; 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: - DefaultProjectileData[j].syrepeat = ProjectileData[j].syrepeat = z; break; + g_tile[j].defproj.syrepeat = g_tile[j].proj.syrepeat = z; break; 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: - DefaultProjectileData[j].isound = ProjectileData[j].isound = z; break; + g_tile[j].defproj.isound = g_tile[j].proj.isound = z; break; 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: - DefaultProjectileData[j].extra = ProjectileData[j].extra = z; break; + g_tile[j].defproj.extra = g_tile[j].proj.extra = z; break; 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: - DefaultProjectileData[j].trail = ProjectileData[j].trail = z; break; + g_tile[j].defproj.trail = g_tile[j].proj.trail = z; break; 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: - DefaultProjectileData[j].tyrepeat = ProjectileData[j].tyrepeat = z; break; + g_tile[j].defproj.tyrepeat = g_tile[j].proj.tyrepeat = z; break; 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: - DefaultProjectileData[j].tnum = ProjectileData[j].tnum = z; break; + g_tile[j].defproj.tnum = g_tile[j].proj.tnum = z; break; 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: - DefaultProjectileData[j].cstat = ProjectileData[j].cstat = z; break; + g_tile[j].defproj.cstat = g_tile[j].proj.cstat = z; break; 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: - DefaultProjectileData[j].shade = ProjectileData[j].shade = z; break; + g_tile[j].defproj.shade = g_tile[j].proj.shade = z; break; 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: - DefaultProjectileData[j].yrepeat = ProjectileData[j].yrepeat = z; break; + g_tile[j].defproj.yrepeat = g_tile[j].proj.yrepeat = z; break; 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: - 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: - DefaultProjectileData[j].hitradius = ProjectileData[j].hitradius = z; break; + g_tile[j].defproj.hitradius = g_tile[j].proj.hitradius = z; break; 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: - DefaultProjectileData[j].offset = ProjectileData[j].offset = z; break; + g_tile[j].defproj.offset = g_tile[j].proj.offset = z; break; 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: - DefaultProjectileData[j].bsound = ProjectileData[j].bsound = z; break; + g_tile[j].defproj.bsound = g_tile[j].proj.bsound = z; break; 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; } - SpriteFlags[j] |= SPRITE_PROJECTILE; + g_tile[j].flags |= SPRITE_PROJECTILE; continue; } @@ -4097,7 +4101,7 @@ static int32_t C_ParseCommand(int32_t loop) continue; } - SpriteFlags[j] = *g_scriptPtr; + g_tile[j].flags = *g_scriptPtr; continue; } @@ -4131,19 +4135,19 @@ static int32_t C_ParseCommand(int32_t loop) switch (tw) { case CON_SPRITESHADOW: - SpriteFlags[*g_scriptPtr] |= SPRITE_SHADOW; + g_tile[*g_scriptPtr].flags |= SPRITE_SHADOW; break; case CON_SPRITENVG: - SpriteFlags[*g_scriptPtr] |= SPRITE_NVG; + g_tile[*g_scriptPtr].flags |= SPRITE_NVG; break; case CON_SPRITENOSHADE: - SpriteFlags[*g_scriptPtr] |= SPRITE_NOSHADE; + g_tile[*g_scriptPtr].flags |= SPRITE_NOSHADE; break; case CON_SPRITENOPAL: - SpriteFlags[*g_scriptPtr] |= SPRITE_NOPAL; + g_tile[*g_scriptPtr].flags |= SPRITE_NOPAL; break; case CON_PRECACHE: - SpriteCacheList[*g_scriptPtr][0] = j; + g_tile[*g_scriptPtr].flags |= SPRITE_CACHE; C_GetNextValue(LABEL_DEFINE); g_scriptPtr--; i = *g_scriptPtr; @@ -4152,11 +4156,16 @@ static int32_t C_ParseCommand(int32_t loop) C_ReportError(ERROR_EXCEEDSMAXTILES); g_numCompilerErrors++; } - SpriteCacheList[j][1] = i; + g_tile[j].cacherange[0] = i; C_GetNextValue(LABEL_DEFINE); 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; } continue; @@ -5716,6 +5725,18 @@ static void C_AddDefaultDefinitions(void) 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_MAPFILENAME",STR_MAPFILENAME,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!"); for (i=MAXTILES-1; i>=0; i--) - Bmemcpy(&ProjectileData[i],&DefaultProjectile,sizeof(projectile_t)); - - Bmemcpy(&DefaultProjectileData[0], &ProjectileData[0], sizeof(ProjectileData)); + { + Bmemcpy(&g_tile[i].proj, &DefaultProjectile, sizeof(projectile_t)); + Bmemcpy(&g_tile[i].defproj, &g_tile[i].proj, sizeof(projectile_t)); + } } #pragma pack(pop) @@ -5882,10 +5904,9 @@ void C_Compile(const char *filenam) kread(fp,(char *)textptr,fs); kclose(fp); - Bmemset(actorscrptr, 0, sizeof(actorscrptr)); - Bmemset(actorLoadEventScrptr, 0, sizeof(actorLoadEventScrptr)); - Bmemset(ActorType, 0, sizeof(ActorType)); -// clearbufbyte(script,sizeof(script),0l); // JBF 20040531: yes? no? + for (i=MAXTILES-1; i>=0; i--) + Bmemset(&g_tile[i], 0, sizeof(tiledata_t)); + if (script != NULL) Bfree(script); @@ -5996,7 +6017,7 @@ void C_Compile(const char *filenam) if (apScriptGameEvent[i]) k++; for (i=MAXTILES-1; i>=0; i--) - if (actorscrptr[i]) + if (g_tile[i].execPtr) l++; if (j) initprintf("%d quotes, ", j); diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 8a8a1e3b3..854974147 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -55,8 +55,6 @@ extern int32_t g_iWallVarID; extern int32_t g_iPlayerVarID; extern int32_t g_iActorVarID; -extern intptr_t *actorLoadEventScrptr[MAXTILES]; - extern intptr_t *apScriptGameEvent[MAXGAMEEVENTS]; extern int32_t otherp; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index f46c542c2..92c407f5a 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -707,15 +707,12 @@ dead: } 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; - else daxvel <<= 1; - } - else - { - if ((vm.g_t[0]&3) || ps->actorsqu == vm.g_i) return; - else daxvel <<= 2; + if (vm.g_t[0]&1) return; + daxvel <<= 1; } } } @@ -1352,7 +1349,7 @@ skip_check: #endif if ((vm.g_sp->hitag & jumptoplayer) || - (actorscrptr[vm.g_sp->picnum] && + (g_tile[vm.g_sp->picnum].execPtr && #ifndef LUNATIC (unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1] #else @@ -1937,12 +1934,12 @@ nullquote: actor[i].flags = 0; sprite[i].hitag = 0; - if (actorscrptr[sprite[i].picnum]) + if (g_tile[sprite[i].picnum].execPtr) { // offsets - T5 = *(actorscrptr[sprite[i].picnum]+1); // action - T2 = *(actorscrptr[sprite[i].picnum]+2); // move - sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3); // ai bits + T5 = *(g_tile[sprite[i].picnum].execPtr+1); // action + T2 = *(g_tile[sprite[i].picnum].execPtr+2); // move + sprite[i].hitag = *(g_tile[sprite[i].picnum].execPtr+3); // ai bits } } 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_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; vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE); @@ -5083,7 +5080,7 @@ void A_LoadActor(int32_t iActor) return; } - insptr = actorLoadEventScrptr[vm.g_sp->picnum]; + insptr = g_tile[vm.g_sp->picnum].loadPtr; VM_Execute(1); 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); #endif - insptr = 4 + (actorscrptr[vm.g_sp->picnum]); + insptr = 4 + (g_tile[vm.g_sp->picnum].execPtr); VM_Execute(1); insptr = NULL; diff --git a/polymer/eduke32/source/gamestructures.c b/polymer/eduke32/source/gamestructures.c index 7ac1fbdb3..a29b3ad87 100644 --- a/polymer/eduke32/source/gamestructures.c +++ b/polymer/eduke32/source/gamestructures.c @@ -3143,253 +3143,253 @@ static void __fastcall VM_AccessProjectile(int32_t iSet, int32_t lVar1, int32_t case PROJ_WORKSLIKE: if (iSet) { - ProjectileData[lVar1].workslike=lValue; + g_tile[lVar1].proj.workslike=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].workslike); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.workslike); return; case PROJ_SPAWNS: if (iSet) { - ProjectileData[lVar1].spawns=lValue; + g_tile[lVar1].proj.spawns=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].spawns); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.spawns); return; case PROJ_SXREPEAT: if (iSet) { - ProjectileData[lVar1].sxrepeat=lValue; + g_tile[lVar1].proj.sxrepeat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].sxrepeat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.sxrepeat); return; case PROJ_SYREPEAT: if (iSet) { - ProjectileData[lVar1].syrepeat=lValue; + g_tile[lVar1].proj.syrepeat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].syrepeat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.syrepeat); return; case PROJ_SOUND: if (iSet) { - ProjectileData[lVar1].sound=lValue; + g_tile[lVar1].proj.sound=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].sound); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.sound); return; case PROJ_ISOUND: if (iSet) { - ProjectileData[lVar1].isound=lValue; + g_tile[lVar1].proj.isound=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].isound); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.isound); return; case PROJ_VEL: if (iSet) { - ProjectileData[lVar1].vel=lValue; + g_tile[lVar1].proj.vel=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].vel); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.vel); return; case PROJ_EXTRA: if (iSet) { - ProjectileData[lVar1].extra=lValue; + g_tile[lVar1].proj.extra=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].extra); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.extra); return; case PROJ_DECAL: if (iSet) { - ProjectileData[lVar1].decal=lValue; + g_tile[lVar1].proj.decal=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].decal); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.decal); return; case PROJ_TRAIL: if (iSet) { - ProjectileData[lVar1].trail=lValue; + g_tile[lVar1].proj.trail=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].trail); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.trail); return; case PROJ_TXREPEAT: if (iSet) { - ProjectileData[lVar1].txrepeat=lValue; + g_tile[lVar1].proj.txrepeat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].txrepeat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.txrepeat); return; case PROJ_TYREPEAT: if (iSet) { - ProjectileData[lVar1].tyrepeat=lValue; + g_tile[lVar1].proj.tyrepeat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].tyrepeat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.tyrepeat); return; case PROJ_TOFFSET: if (iSet) { - ProjectileData[lVar1].toffset=lValue; + g_tile[lVar1].proj.toffset=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].toffset); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.toffset); return; case PROJ_TNUM: if (iSet) { - ProjectileData[lVar1].tnum=lValue; + g_tile[lVar1].proj.tnum=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].tnum); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.tnum); return; case PROJ_DROP: if (iSet) { - ProjectileData[lVar1].drop=lValue; + g_tile[lVar1].proj.drop=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].drop); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.drop); return; case PROJ_CSTAT: if (iSet) { - ProjectileData[lVar1].cstat=lValue; + g_tile[lVar1].proj.cstat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].cstat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.cstat); return; case PROJ_CLIPDIST: if (iSet) { - ProjectileData[lVar1].clipdist=lValue; + g_tile[lVar1].proj.clipdist=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].clipdist); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.clipdist); return; case PROJ_SHADE: if (iSet) { - ProjectileData[lVar1].shade=lValue; + g_tile[lVar1].proj.shade=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].shade); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.shade); return; case PROJ_XREPEAT: if (iSet) { - ProjectileData[lVar1].xrepeat=lValue; + g_tile[lVar1].proj.xrepeat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].xrepeat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.xrepeat); return; case PROJ_YREPEAT: if (iSet) { - ProjectileData[lVar1].yrepeat=lValue; + g_tile[lVar1].proj.yrepeat=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].yrepeat); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.yrepeat); return; case PROJ_PAL: if (iSet) { - ProjectileData[lVar1].pal=lValue; + g_tile[lVar1].proj.pal=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].pal); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.pal); return; case PROJ_EXTRA_RAND: if (iSet) { - ProjectileData[lVar1].extra_rand=lValue; + g_tile[lVar1].proj.extra_rand=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].extra_rand); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.extra_rand); return; case PROJ_HITRADIUS: if (iSet) { - ProjectileData[lVar1].hitradius=lValue; + g_tile[lVar1].proj.hitradius=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].hitradius); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.hitradius); return; case PROJ_MOVECNT: if (iSet) { - ProjectileData[lVar1].movecnt=lValue; + g_tile[lVar1].proj.movecnt=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].movecnt); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.movecnt); return; case PROJ_OFFSET: if (iSet) { - ProjectileData[lVar1].offset=lValue; + g_tile[lVar1].proj.offset=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].offset); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.offset); return; case PROJ_BOUNCES: if (iSet) { - ProjectileData[lVar1].bounces=lValue; + g_tile[lVar1].proj.bounces=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].bounces); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.bounces); return; case PROJ_BSOUND: if (iSet) { - ProjectileData[lVar1].bsound=lValue; + g_tile[lVar1].proj.bsound=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].bsound); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.bsound); return; case PROJ_RANGE: if (iSet) { - ProjectileData[lVar1].range=lValue; + g_tile[lVar1].proj.range=lValue; return; } - Gv_SetVarX(lVar2, ProjectileData[lVar1].range); + Gv_SetVarX(lVar2, g_tile[lVar1].proj.range); return; default: diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index b3b3c937e..a7ad3c7fa 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1017,7 +1017,8 @@ void Gv_ResetSystemDefaults(void) g_iPlayerVarID=Gv_GetVarIndex("player"); 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"); } diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 0ee79f377..4f443fac0 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -37,6 +37,7 @@ int32_t neartaghitdist,lockclock,g_startArmorAmount; int32_t g_spriteGravity=176; actor_t actor[MAXSPRITES]; +tiledata_t g_tile[MAXTILES]; int16_t SpriteDeletionQueue[1024],g_spriteDeleteQueuePos,g_spriteDeleteQueueSize=64; animwalltype animwall[MAXANIMWALLS]; @@ -110,9 +111,8 @@ int32_t vel, svel, angvel, horiz, ototalclock, g_actorRespawnTime=768, g_itemRes intptr_t *g_scriptPtr,*insptr; int32_t *labelcode, *labeltype; int32_t g_numLabels,g_numDefaultLabels; -intptr_t *actorscrptr[MAXTILES],*g_parsingActorPtr; +intptr_t *g_parsingActorPtr; char *label; -char ActorType[MAXTILES]; intptr_t *script = NULL; int32_t g_scriptSize = 1048576; @@ -171,9 +171,7 @@ int32_t oldipos[MAXINTERPOLATIONS]; int32_t bakipos[MAXINTERPOLATIONS]; int32_t *curipos[MAXINTERPOLATIONS]; -int32_t SpriteFlags[MAXTILES]; - -projectile_t ProjectileData[MAXTILES], DefaultProjectileData[MAXTILES], SpriteProjectile[MAXSPRITES]; +projectile_t SpriteProjectile[MAXSPRITES]; char CheatKeys[2] = { sc_D, sc_N }; char setupfilename[BMAX_PATH]= SETUPFILENAME; diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index a2e5a87aa..9d5b9dcec 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -44,10 +44,10 @@ G_EXTERN int32_t connectpoint2[MAXPLAYERS]; G_EXTERN const char *s_buildRev; G_EXTERN DukeStatus_t sbar; G_EXTERN actor_t actor[MAXSPRITES]; +G_EXTERN tiledata_t g_tile[MAXTILES]; G_EXTERN animwalltype animwall[MAXANIMWALLS]; G_EXTERN char *ScriptQuotes[MAXQUOTES],*ScriptQuoteRedefinitions[MAXQUOTES]; G_EXTERN char *label; -G_EXTERN char ActorType[MAXTILES]; G_EXTERN char CheatKeys[2]; G_EXTERN char EnvMusicFilename[MAXVOLUMES+1][BMAX_PATH]; 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 *curipos[MAXINTERPOLATIONS]; 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 bakipos[MAXINTERPOLATIONS]; G_EXTERN int32_t cloudtotalclock; @@ -120,14 +119,14 @@ G_EXTERN int32_t playerswhenstarted; G_EXTERN int32_t screenpeek; G_EXTERN int32_t startofdynamicinterpolations; 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 int32_t *labelcode,*labeltype; G_EXTERN intptr_t *script; G_EXTERN map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music G_EXTERN playerdata_t g_player[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 uint32_t everyothertime; G_EXTERN uint32_t g_moveThingsCount; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 2611137f6..1885fa950 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -1583,6 +1583,7 @@ void M_DisplayMenus(void) KB_FlushKeyboardQueue(); KB_ClearKeysDown(); FX_StopAllSounds(); + S_ClearSoundLocks(); 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(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"; 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); - 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"; 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); - 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"; 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); - 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"; 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); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 09ce4fb14..f062968f4 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -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]/ProjectileData[atwith].offset); - srcvect.y = sv->y + (sintable[(ang+348)&2047]/ProjectileData[atwith].offset); - srcvect.z = sv->z + 1024+(ProjectileData[atwith].toffset<<8); + 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); 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=ProjectileData[atwith].tnum; i>0; i--) + for (i=g_tile[atwith].proj.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,ProjectileData[atwith].trail,-32, - ProjectileData[atwith].txrepeat,ProjectileData[atwith].tyrepeat,ang,0,0,g_player[0].ps->i,0); + j = A_InsertSprite(sect,srcvect.x,srcvect.y,srcvect.z,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); 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) && (ProjectileData[atwith].workslike & PROJECTILE_RPG)) + if (A_CheckSpriteTileFlags(atwith,SPRITE_PROJECTILE) && (g_tile[atwith].proj.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 (ProjectileData[atwith].flashcolor) + if (g_tile[atwith].proj.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, 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; s-> x -= x; s-> y -= y; } #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); if (p < 0) sa += 1024; zvel = 1024-(krand()&2047); } - if (ProjectileData[atwith].workslike & PROJECTILE_KNEE) + if (g_tile[atwith].proj.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 (!(ProjectileData[atwith].workslike & PROJECTILE_NOAIM)) + else if (!(g_tile[atwith].proj.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 (ProjectileData[atwith].workslike & PROJECTILE_BLOOD) + if (g_tile[atwith].proj.workslike & PROJECTILE_BLOOD) { - if (ProjectileData[atwith].range == 0) - ProjectileData[atwith].range = 1024; + if (g_tile[atwith].proj.range == 0) + 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) > - (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 ((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(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)) 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 (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)) 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 (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE) + if (g_tile[atwith].proj.workslike & PROJECTILE_RANDDECALSIZE) { - int32_t wh = (krand()&ProjectileData[atwith].xrepeat); - if (wh < ProjectileData[atwith].yrepeat) - wh = ProjectileData[atwith].yrepeat; + int32_t wh = (krand()&g_tile[atwith].proj.xrepeat); + if (wh < g_tile[atwith].proj.yrepeat) + wh = g_tile[atwith].proj.yrepeat; sprite[k].xrepeat = wh; sprite[k].yrepeat = wh; } else { - sprite[k].xrepeat = ProjectileData[atwith].xrepeat; - sprite[k].yrepeat = ProjectileData[atwith].yrepeat; + sprite[k].xrepeat = g_tile[atwith].proj.xrepeat; + sprite[k].yrepeat = g_tile[atwith].proj.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 ((ProjectileData[atwith].range == 0) && (ProjectileData[atwith].workslike & PROJECTILE_KNEE)) - ProjectileData[atwith].range = 1024; + 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) && ((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; 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 = 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); + 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); 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); 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) @@ -655,9 +655,9 @@ int32_t A_Shoot(int32_t i, int32_t atwith) 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) { @@ -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 (ProjectileData[atwith].workslike & PROJECTILE_ACCURATE_AUTOAIM) + if (g_tile[atwith].proj.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 (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + if (!(g_tile[atwith].proj.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 (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + if (!(g_tile[atwith].proj.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 (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + if (!(g_tile[atwith].proj.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 (!(ProjectileData[atwith].workslike & PROJECTILE_ACCURATE)) + if (!(g_tile[atwith].proj.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 (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; 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 (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; if (hit.sect < 0) return -1; - 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; - if (ProjectileData[atwith].trail >= 0) + if (g_tile[atwith].proj.trail >= 0) 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) 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 = ProjectileData[atwith].extra; - if (ProjectileData[atwith].extra_rand > 0) - sprite[k].extra += (krand()%ProjectileData[atwith].extra_rand); + 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].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 (ProjectileData[atwith].spawns >= 0) + if (g_tile[atwith].proj.spawns >= 0) { - 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; + 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; A_SetHitData(wh, &hit); } } @@ -818,11 +818,11 @@ int32_t A_Shoot(int32_t i, int32_t atwith) } else { - if (ProjectileData[atwith].spawns >= 0) + if (g_tile[atwith].proj.spawns >= 0) { - 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; + 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; A_SetHitData(wh, &hit); } } @@ -834,11 +834,11 @@ int32_t A_Shoot(int32_t i, int32_t atwith) } 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); - if (ProjectileData[atwith].sxrepeat > 4) sprite[wh].xrepeat=ProjectileData[atwith].sxrepeat; - if (ProjectileData[atwith].syrepeat > 4) sprite[wh].yrepeat=ProjectileData[atwith].syrepeat; + 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; 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 == ProjectileData[atwith].decal) + if (sprite[l].picnum == g_tile[atwith].proj.decal) if (dist(&sprite[l],&sprite[k]) < (12+(krand()&7))) goto DOSKIPBULLETHOLE; 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)) 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 (ProjectileData[atwith].workslike & PROJECTILE_RANDDECALSIZE) + if (g_tile[atwith].proj.workslike & PROJECTILE_RANDDECALSIZE) { - int32_t wh = (krand()&ProjectileData[atwith].xrepeat); - if (wh < ProjectileData[atwith].yrepeat) - wh = ProjectileData[atwith].yrepeat; + int32_t wh = (krand()&g_tile[atwith].proj.xrepeat); + if (wh < g_tile[atwith].proj.yrepeat) + wh = g_tile[atwith].proj.yrepeat; sprite[l].xrepeat = wh; sprite[l].yrepeat = wh; } else { - sprite[l].xrepeat = ProjectileData[atwith].xrepeat; - sprite[l].yrepeat = ProjectileData[atwith].yrepeat; + sprite[l].xrepeat = g_tile[atwith].proj.xrepeat; + sprite[l].yrepeat = g_tile[atwith].proj.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 = ProjectileData[atwith].extra; - if (ProjectileData[atwith].extra_rand > 0) - sprite[k].extra += (krand()%ProjectileData[atwith].extra_rand); + 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].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 (ProjectileData[atwith].spawns >= 0) + if (g_tile[atwith].proj.spawns >= 0) { - 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; + 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; A_SetHitData(wh, &hit); } } @@ -947,21 +947,21 @@ DOSKIPBULLETHOLE: A_DamageWall(k,hit.wall,&hit.pos,atwith); } - if ((krand()&255) < 4 && ProjectileData[atwith].isound >= 0) - S_PlaySound3D(ProjectileData[atwith].isound,k,&hit.pos); + if ((krand()&255) < 4 && g_tile[atwith].proj.isound >= 0) + S_PlaySound3D(g_tile[atwith].proj.isound,k,&hit.pos); 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);*/ - 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; @@ -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)*(ProjectileData[atwith].vel/8); + zvel = (100-ps->horiz-ps->horizoff)*(g_tile[atwith].proj.vel/8); // zvel = (100-ps->horiz-ps->horizoff)*81; - if (ProjectileData[atwith].sound >= 0) - A_PlaySound(ProjectileData[atwith].sound,i); + if (g_tile[atwith].proj.sound >= 0) + A_PlaySound(g_tile[atwith].proj.sound,i); } else { - if (!(ProjectileData[atwith].workslike & PROJECTILE_NOAIM)) + if (!(g_tile[atwith].proj.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]/ProjectileData[atwith].offset), - srcvect.y+(sintable[(sa+348)&2047]/ProjectileData[atwith].offset), + srcvect.x+(sintable[(348+sa+512)&2047]/g_tile[atwith].proj.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); - sprite[j].xrepeat=ProjectileData[atwith].xrepeat; - sprite[j].yrepeat=ProjectileData[atwith].yrepeat; + sprite[j].xrepeat=g_tile[atwith].proj.xrepeat; + sprite[j].yrepeat=g_tile[atwith].proj.yrepeat; - if (ProjectileData[atwith].extra_rand > 0) - sprite[j].extra += (krand()&ProjectileData[atwith].extra_rand); - if (!(ProjectileData[atwith].workslike & PROJECTILE_BOUNCESOFFWALLS)) + 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)) sprite[j].yvel = l; 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; // sprite[j].xrepeat >>= 1; // sprite[j].yrepeat >>= 1; @@ -1030,20 +1030,20 @@ DOSKIPBULLETHOLE: /* 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].yrepeat = ProjectileData[atwith].yrepeat; + sprite[j].xrepeat = tile[atwith].proj.xrepeat; // 30 + sprite[j].yrepeat = tile[atwith].proj.yrepeat; 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; - 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; - 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); // zvel = oldzvel+512-(krand()&1023); @@ -1280,7 +1280,7 @@ DOSKIPBULLETHOLE: 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 = *actorscrptr[atwith]; + sprite[k].extra = *g_tile[atwith].execPtr; sprite[k].extra += (krand()%6); sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 A_SetHitData(k, &hit); @@ -1400,7 +1400,7 @@ SKIPBULLETHOLE: 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 = *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 A_SetHitData(k, &hit); diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 51f22927c..2cb87985e 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -43,7 +43,6 @@ extern El_State g_ElState; static int32_t g_whichPalForPlayer = 9; int32_t g_numRealPalettes; -int16_t SpriteCacheList[MAXTILES][3]; static uint8_t precachehightile[2][MAXTILES>>3]; static int32_t g_precacheCount; @@ -91,8 +90,8 @@ static void G_CacheSpriteNum(int32_t i) maxc = 1; - if (SpriteCacheList[PN][0] == PN) - for (j = PN; j <= SpriteCacheList[PN][1]; j++) + if (A_CheckSpriteTileFlags(PN, SPRITE_CACHE) && g_tile[PN].cacherange[1]) + for (j = g_tile[PN].cacherange[0]; j <= g_tile[PN].cacherange[1]; j++) tloadtile(j,1); switch (DYNAMICTILEMAP(PN)) @@ -227,10 +226,11 @@ static void G_PrecacheSprites(void) for (i=0; i>3]&(BITPTR_POINTER<<(i&7))) script[i] = (intptr_t *)script[i] - script; - G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_FWD_NON0); - G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_FWD_NON0); + G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0); + G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_FWD_NON0); } static void sv_prescriptload_once() { @@ -1490,8 +1511,8 @@ static void sv_postscript_once() { int32_t i; - G_Util_PtrToIdx(actorscrptr, MAXTILES, script, P2I_BACK_NON0); - G_Util_PtrToIdx(actorLoadEventScrptr, MAXTILES, script, P2I_BACK_NON0); + G_Util_PtrToIdx2(&g_tile[0].execPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0); + G_Util_PtrToIdx2(&g_tile[0].loadPtr, MAXTILES, sizeof(tiledata_t), script, P2I_BACK_NON0); for (i=0; i>3]&(BITPTR_POINTER<<(i&7))) diff --git a/polymer/eduke32/source/savegame.h b/polymer/eduke32/source/savegame.h index f8b194956..fd863dfe4 100644 --- a/polymer/eduke32/source/savegame.h +++ b/polymer/eduke32/source/savegame.h @@ -81,5 +81,6 @@ enum P2I_BACK_NON0 = 1+2, }; 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 diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index c66a6360d..fe8acb6a7 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -2123,7 +2123,7 @@ void A_DamageObject(int32_t i,int32_t sn) case FUELPOD__STATIC: case SOLARPANNEL__STATIC: case ANTENNA__STATIC: - if (sprite[sn].extra != *actorscrptr[SHOTSPARK1]) + if (sprite[sn].extra != *g_tile[SHOTSPARK1].execPtr) { for (j=15; j>0; j--) 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 (sprite[sn].picnum != FREEZEBLAST) - if (ActorType[PN] == 0) + if (!A_CheckSpriteTileFlags(PN, SPRITE_BADGUY)) { j = A_Spawn(sn,JIBS6); if (sprite[sn].pal == 6) diff --git a/polymer/eduke32/source/xdelta3/xdelta3.h b/polymer/eduke32/source/xdelta3/xdelta3.h index fcd254d84..7d7598b4a 100644 --- a/polymer/eduke32/source/xdelta3/xdelta3.h +++ b/polymer/eduke32/source/xdelta3/xdelta3.h @@ -25,9 +25,11 @@ #ifndef _XDELTA3_H_ #define _XDELTA3_H_ +/* #define _POSIX_SOURCE #define _ISOC99_SOURCE #define _C99_SOURCE +*/ #include #include